Hindi Songs

Search About PHP!!!

Wednesday, July 1, 2009

Create an Upload-File Form

To allow users to upload files from a form can be very useful.
Look at the following HTML form for uploading files:
< html >
< body >

< form action="upload_file.php" method="post"
enctype="multipart/form-data" >
< label for="file">Filename:< /label >
< input type="file" name="file" id="file" / >
< br / >
< input type="submit" name="submit" value="Submit" / >
< /form >

< /body >
< /html >
Notice the following about the HTML form above:
• The enctype attribute of the < form > tag specifies which content-type to use when submitting the form. "multipart/form-data" is used when a form requires binary data, like the contents of a file, to be uploaded
• The type="file" attribute of the < input > tag specifies that the input should be processed as a file. For example, when viewed in a browser, there will be a browse-button next to the input field
Note: Allowing users to upload files is a big security risk. Only permit trusted users to perform file uploads.