Входной объект FileUpload HTML DOM
Входной объект FileUpload
Объект Input FileUpload представляет элемент HTML <input> с type="file".
Доступ к входному объекту FileUpload
Вы можете получить доступ к элементу <input> с type="file" с помощью getElementById():
Пример
var x = document.getElementById("myFile");
Совет: Вы также можете получить доступ к <input type="file">, выполнив поиск в коллекции элементов формы.
Создайте входной объект FileUpload
Вы можете создать элемент <input> с type="file" с помощью метода document.createElement():
Пример
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Входные свойства объекта FileUpload
Property | Description |
---|---|
accept | Sets or returns the value of the accept attribute of the file upload button |
autofocus | Sets or returns whether a file upload button should automatically get focus upon page load |
defaultValue | Sets or returns the default value of the file upload button |
disabled | Sets or returns whether the file upload button is disabled, or not |
files | Returns a FileList object that represents the file or files selected with the file upload button |
form | Returns a reference to the form that contains the file upload button |
multiple | Sets or returns whether a user is allowed to select more than one file in the file upload field |
name | Sets or returns the value of the name attribute of the file upload button |
required | Sets or returns whether a file in the file upload field must be selected before submitting a form |
type | Returns which type of form element the file upload button is |
value | Returns the path or the name of the selected file |
Стандартные свойства и события
Объект Input FileUpload также поддерживает стандартные свойства и события .
Связанные страницы
Учебник по HTML: HTML-формы
Справочник по HTML: HTML-тег <input>
Справочник по HTML: HTML-атрибут типа <input>