Thursday, January 20, 2011

To create an File upload Form using html





To make users to upload files can be very useful. Here is an 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>



Here the enctype attribute of the <form> tag specifies which content-type to use when submitting the form.

The type="file" attribute of the <input> tag specifies that the input is processed in form of a file.