Monday, November 19, 2012

File uploading

I have got more experience with file uploading using php.Finaly i created a correct code definition for file uploading using php .This is the fileupload.html file.

Untitled Document



enctype="multipart/form-data">





this is the PHP file for the server side.upload_file.php,


Untitled Document
if ($_FILES["file"]["error"] > 0)
{
echo 'sanji went';
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>

when we upload a file it save in tmp folder in our localhost server. After that we can change the location using move funtion.

No comments:

Post a Comment