Name
FileUpload — a file upload field for form input
Availability
JavaScript 1.0 Inherits from Input, HTMLElement
Synopsis
form
.name
form
.elements[i
]
Properties
FileUpload inherits properties from Input and HTMLElement and defines or overrides the following:
-
value
[ JavaScript 1.1] A read-only string that specifies the filename entered by the user into the FileUpload object. The user may enter a filename either by typing it directly or by using the directory browser associated with the FileUpload object.
To prevent malicious programs from uploading arbitrary files from the
client, this property may not be set by JavaScript code. Similarly,
the value
attribute of the
<input>
tag does not specify the initial
value for this property.
Methods
FileUpload inherits methods from Input and HTMLElement.
Event Handlers
FileUpload inherits event handlers from Input and HTMLElement and defines or overrides the following:
-
onchange
Invoked when the user changes the value in the FileUpload element and moves the keyboard focus elsewhere. This event handler is not invoked for every keystroke in the FileUpload element, but only when the user completes an edit.
HTML Syntax
A FileUpload element is created with a standard
HTML
<input>
tag:
<form enctype="multipart/form-data" method="post"> // Required attributes ... <input type="file" // Specifies that this is a FileUpload element [ name="name
" ] // A name you can use later to refer to this element // Specifies the name property [ size="integer
" ] // How ...
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.