
How To Write the FORM Tag Correctly for Uploading Files?

Write like this in ur programe

Hi,
The "html" form code for uploading file is:
<html> <body> <form action="uploadfiles.php" method="post" enctype="multipart/form-data"> <label>Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html>
The uploadfiles.php code is:
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "" . $_FILES["file"]["tmp_name"];
}
?>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.