HTML DOM FileUpload objects
FileUpload object
HTML document <input type = "file"> tag appears every time a FileUpload object is created.
This element contains a text input field to enter a file name, there is a button to open the file selection dialog to graphically select the file.
value attribute of the element holds the name of the file specified by the user, but when elements contain a file-upload form is submitted, the browser will send the contents of the selected file to the server rather than just send the file name.
For safety reasons, file-upload element does not allow HTML authors or JavaScript programmer to specify a default file name. HTML value attribute is ignored, and it is for this type of element, value property is read-only, which means that only the user can enter a file name. When the user selects a file or edit the name, file-upload element trigger onchange event handler.
You can [] array, or to access the FileUpload object by traversing the form elements by using document.getElementById ().
FileUpload object properties
W3C: W3C standards.
属性 | 描述 | W3C |
---|---|---|
disabled | 设置或返回是否禁用 FileUpload 对象。 | Yes |
accept | 设置或返回指示文件传输的 MIME 类型的列表(逗号分隔)。 | Yes |
form | 返回对包含 FileUpload 对象的表单的引用。 | Yes |
name | 设置或返回 FileUpload 对象的名称。 | Yes |
type | 返回表单元素的类型。对于 FileUpload ,则是 "file" 。 | Yes |
value | 返回由用户输入设置的文本后,FileUpload 对象的文件名。 | Yes |
Standard properties and events
FileUpload object also supports the standard attributes and events .