HTML and CSS Reference
In-Depth Information
like a regular text field, transmitting its value (that is, the file's path-
name) to the server instead of the contents of the file itself.
All of this is easier than it may sound. For example, here is an HTML
form that collects a person's name and favorite file:
<form enctype="multipart/form-data" method=post
Your name: <input type=text size=20 name=the_name>
Your favorite file: <input type=file size=20 name=fav_file>
The data transmitted from the browser to the server for this example
form has two parts. The first contains the value for the name field, and
the second contains the name and contents of the specified file:
Content-Disposition: form-data; name="the_name"
One line of text field contents
Content-Disposition: form-data; name="fav_file"; filename="abc"
First line of file
Last line of file
The browsers don't check that the user has specified a valid file. If no
file is specified, the filename portion of the Content-Disposition head-
er is empty. If the file doesn't exist, its name appears in the filename
subheader, but there is no Content-Type header or subsequent lines of
file content. Valid files may contain nonprintable or binary data; there
is no way to restrict user-selectable file types. In light of these poten-
Search WWH ::

Custom Search