Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
412
Chapter 16 Using HTML Forms
16.7 File Upload Controls
HTML Element:
(No End Tag)
Attributes:
NAME
(required),
VALUE
(ignored),
SIZE
,
MAXLENGTH
,
ACCEPT
,
ONCHANGE
,
ONSELECT
,
ONFOCUS
,
ONBLUR
(nonstandard)
This element results in a filename textfield next to a Browse button. Users
can enter a path directly in the textfield or click on the button to bring up a
file selection dialog that lets them interactively choose the path to a file.
When the form is submitted, the contents of the file are transmitted as long
as an
ENCTYPE
of
multipart/form data
was specified in the initial
FORM
declaration. This element provides a convenient way to make user support
pages, where the user sends a description of the problem along with any asso
ciated data or configuration files.
Core Tip
Always specify
ENCTYPE="multipart/form data"
in forms with file
upload controls.
NAME
The
NAME
attribute identifies the textfield when the form is submitted.
VALUE
For security reasons, this attribute is ignored. Only the end user can
specify a filename.
SIZE and MAXLENGTH
The
SIZE
and
MAXLENGTH
attributes are used the same way as in text
fields, specifying the number of visible and maximum allowable charac
ters, respectively.
ACCEPT
The
ACCEPT
attribute is intended to be a comma separated list of
MIME types used to restrict the available filenames. However, very few
browsers support this attribute.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved