` tag in an HTML document, a FileUpload object is created. This element includes a text"> ` tag in an HTML document, a FileUpload object is created. This element includes a text" />
Easy Tutorial
❮ Jsref Getutcmilliseconds Prop Anchor Charset ❯

HTML DOM


FileUpload Object

For every occurrence of the <input type="file"> tag in an HTML document, a FileUpload object is created.

This element includes a text input field for entering the file name and a button to open a file selection dialog for graphically selecting the file.

The value attribute of this element holds the name of the file specified by the user, but when a form containing a file-upload element is submitted, the browser sends the contents of the selected file to the server, not just the file name.

For security reasons, the file-upload element does not allow HTML authors or JavaScript programmers to specify a default file name. The HTML value attribute is ignored, and for such elements, the value attribute is read-only, meaning only the user can enter a file name. When the user selects or edits a file name, the file-upload element triggers an onchange event handler.

You can access the FileUpload object by traversing the form's elements[] array or by using document.getElementById().


FileUpload Object Properties

W3C: W3C Standard.

Property Description W3C
disabled Sets or returns whether the FileUpload object is disabled. Yes
accept Sets or returns a list of MIME types for file transfer (comma-separated). Yes
form Returns a reference to the form that contains the FileUpload object. Yes
name Sets or returns the name of the FileUpload object. Yes
type Returns the type of the form element. For FileUpload, it is "file". Yes
value Returns the file name of the FileUpload object as set by the user. Yes

Standard Attributes and Events

The FileUpload object also supports standard attributes and events.

❮ Jsref Getutcmilliseconds Prop Anchor Charset ❯