File Upload Code in PHP ( File Name Must be without Space)
Example
<>
form action="upload_My_File.PHP" enctype="multipart/form-data" method="post"
FILE NAME:
<>
input id="file" name="file" type="file"
<>input name="submit" type="submit" value="Submit"
/form>
----------------------------------------------------------
{
//if file NOT exists
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "File Type: " . $_FILES["file"]["type"] . "
";
echo "File Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Location Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
----------------------------------------------------------------
Example
<>
form action="upload_My_File.PHP" enctype="multipart/form-data" method="post"
FILE NAME:
<>
input id="file" name="file" type="file"
<>input name="submit" type="submit" value="Submit"
/form>
----------------------------------------------------------
{
//if file NOT exists
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "File Type: " . $_FILES["file"]["type"] . "
";
echo "File Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Location Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
----------------------------------------------------------------
0 comments:
Post a Comment