HTML and CSS Reference
In-Depth Information
ted when the form is submitted to the server, unless you are using a
web server running Secure Sockets Layer (SSL) ( https server, for ex-
ample). So, while prying eyes may not see them onscreen, devious bad
guys may steal the information electronically.
9.5.1.3. File-selection controls
As its name implies, the file-selection control lets a user select a file
stored on the computer and send it to the server when she submits the
form. Create a file-selection control in a form by setting the value of the
type attribute to file . Like other text controls, the size and maxlength
of a file-selection field should be set to appropriate values, with the
browser creating a field 20 characters wide, if not otherwise directed.
The browser presents the file-selection form control to the user like oth-
er text fields, accompanied by a button labeled Browse to its right. Users
either type the pathname of the file directly as text into the field or, with
the Browse option, select the pathname of the file from a system-spe-
cific dialog box.
The Browse button opens a platform-specific file-selection dialog box
that allows users to select a value for the field. In this case, the entire
pathname of the selected file is placed into the field, even if the length
of that pathname exceeds the control's specified maxlength .
Use the accept attribute to constrain the types of files that the browser
lets the user browse, even though it does not constrain what they may
type in as the pathname. accept 's value is a comma-separated list of
MIME encodings; users browse and select only files whose type matches
one of those in the list. For example, to restrict the selection to images,
you might add accept="image/*" to the file-selection <input> tag.
Unlike other form input controls, the file-selection field works correctly
only with a specific form data encoding and transmission method. If you
include one or more file-selection fields in your form, you must set the
enctype attribute of the <form> tag to multipart/form-data and the <form>
tag's method attribute to post . Otherwise, the file-selection field behaves
 
Search WWH ::




Custom Search