Thursday, July 10, 2008

<input> Tag - File Selection

<input type="file" size="20" />
The above code presents the user with a text box and a button labeled "Browse" to its right. The maxlength attribute does not seem to have any effect here.
The accept attribute is supposed to specify the kind of file the user can choose. However, currently only Opera supports this. Other browsers ignore the accept attribute and allow the user to choose any filetype.
The accept attribute's value is a comma-separated list of MIME types (eg. accept="image/gif,image/jpeg" ).
The form which contains the file selection control must use the post method and the enctype must be multipart/form-data . If the form uses the get method, then the name of the file (not the entire path), is sent as if it were entered in a regular test field, any spaces in the name of the file is converted into pluses (+).
Note that the enctype attribute specifies the content-type only when the value of method is post.

No comments: