
How To Write the FORM Tag Correctly for Uploading Files?

Hi friends,
When you clicks the submit button, files specified in the <INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written <FORM...> tag as:
<FORM ACTION=receiving.php METHOD=post ENCTYPE=multipart/form-data>
Note that you must specify METHOD as "post" and ENCTYPE as "multipart/form-data" in order for the uploading process to work. The following PHP code, called logo_upload.php, shows you a complete FORM tag for file uploading:
How To Write the FORM Tag Correctly for Uploading Files?
<?php
print("<html><form action=file_uploading.php"."
method=post enctype=multipart/form-data>\n");
print("<b>Please submit an image file</b> "."<br>\n");
print("<input type=file name='imageFile'><br>\n");
print("<input type=submit>\n");
print("</form></html>\n");
?>
How To Get the Uploaded File Information in the Receiving Script?
<html> <head> <title></title> </head> <?php $imageName=$_FILES['imageFile']['name']; ?> <?php $imageType=$_FILES['imageFile']['type']; ?> <?php $imageSize=$_FILES['imageFile']['size']; ?> <?php $imageTemFileName=$_FILES['imageFile']['tmp_name']; ?> <body > <?php echo "Name of file : ".$imageName."<br>"; ?> <?php echo "Type of file : ".$imageType."<br>";?> <?php echo "Size of file : ".$imageSize."<br>"; ?> <?php echo "Tem file name : ".$imageTemFileName. "<br>";?> </body> </html>
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.