HTML DOM Input FileUpload Object
Input FileUpload-object
Het Input FileUpload-object vertegenwoordigt een HTML <input>-element met type="file".
Toegang tot een Input FileUpload-object
U kunt toegang krijgen tot een <input>-element met type="file" door getElementById() te gebruiken:
Voorbeeld
var x = document.getElementById("myFile");
Tip: U kunt <input type="file"> ook openen door te zoeken in de elementenverzameling van een formulier.
Maak een Input FileUpload-object
U kunt een <input>-element maken met type="file" met behulp van de document.createElement()-methode:
Voorbeeld
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Eigenschappen voor Input FileUpload-object
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 |
Standaard eigenschappen en evenementen
Het Input FileUpload - object ondersteunt ook de standaard eigenschappen en gebeurtenissen .
Gerelateerde pagina's
HTML-zelfstudie: HTML-formulieren
HTML-referentie: HTML <input>-tag
HTML-referentie: HTML <input> type attribuut