introduction to web programming File Upload Widget One of the little used TYPEs for the <INPUT> tag is the FILE type.

This input widget automatically creates a text field and a "Browse" button that the user can click in order to select a file to upload from their local hard drive.

It then associates the file contents with the NAME defined in the <INPUT> tag.

Below is a basic example. Click on the browse button and see how easy it is to use.

The previous input elements were created with the following code:

    <FORM>
    <INPUT TYPE = "FILE" NAME = "upload_file">
    </FORM>
The input tag also takes an ACCEPT attribute that defines which media types are acceptable for upload. Of course, by default, any type of file can be uploaded.

File handling over HTTP is a little more complex then simple form data and requires an ENCTYPE of multipart/form-data. However, we will discuss handling file uploads tomorrow. For now, you should just familiarize yourself with the input widget.

Previous | Next | Table of Contents