HTML DOM FileUploadObject
FileUpload Object
In an HTML document, each time the <input type="file"> tag appears, a FileUpload object is created.
This element contains a text input field for entering the file name, and a button for opening the file selection dialog box so that files can be selected graphically.
The value attribute of this element stores 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 that only the user can enter a file name. When the user selects or edits a file name, the file-upload element triggers the 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 comma-separated list of MIME types indicating the file transfer. | 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 text entered by the user. | Yes |
Standard Properties and Events
FileUpload object also supports standardPropertiesandEvents。
Other Extensions