using FORM tag appropriately for uploading files

The files specified in the will be transferred from the browser to the Web server by using a HTTP Post. This transferring (uploading) process is controlled by a properly written tag.

Example:

  <FORM ACTION=receiving.php METHOD=post ENCTYPE=multipart/form-data>

The METHOD must be “post” and ENCTYPE must be “multipart/form-data” in order for the process to work.

Example code:

<?php
  print("<html><form action=filesupload.php method=post enctype=multipart/form-data>\n");
  print("Please submit an image file to w3mentor:<br>\n");
  print("<input type=file name=imgfile><br>\n");
  print("<input type=submit>\n");
  print("</form></html>\n");
?>
Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

 

 
eXTReMe Tracker