Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP How To Write the FORM Tag Correctly for Uploading Files?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


brijesh
How To Write the FORM Tag Correctly for Uploading Files?
2 Answer(s)      3 years and 11 months ago
Posted in : PHP


How To Write the FORM Tag Correctly for Uploading Files?


Advertisement
View Answers

November 12, 2010 at 4:04 PM


Write like this in ur programe



November 13, 2010 at 4:28 PM


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



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com