HTML DOM Input FileUpload Object
Wprowadź obiekt FileUpload
Obiekt Input FileUpload reprezentuje element HTML <input> z typem="file".
Uzyskaj dostęp do wejściowego obiektu FileUpload
Możesz uzyskać dostęp do elementu <input> z type="file" za pomocą getElementById():
Przykład
var x = document.getElementById("myFile");
Wskazówka: możesz również uzyskać dostęp do <input type="file">, przeszukując kolekcję elementów formularza.
Utwórz wejściowy obiekt FileUpload
Możesz utworzyć element <input> z type="file" za pomocą metody document.createElement():
Przykład
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Wejściowe właściwości obiektu 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 |
Standardowe właściwości i zdarzenia
Obiekt Input FileUpload obsługuje również standardowe właściwości i zdarzenia .
Powiązane strony
Samouczek HTML: formularze HTML
Odniesienie HTML: tag HTML <input>
Odniesienie HTML: atrybut typu HTML <input>