Objet FileUpload d'entrée HTML DOM
Objet FileUpload d'entrée
L'objet Input FileUpload représente un élément HTML <input> avec type="file".
Accéder à un objet FileUpload d'entrée
Vous pouvez accéder à un élément <input> avec type="file" en utilisant getElementById() :
Exemple
var x = document.getElementById("myFile");
Conseil : Vous pouvez également accéder à <input type="file"> en recherchant dans la collection d' éléments d'un formulaire.
Créer un objet FileUpload d'entrée
Vous pouvez créer un élément <input> avec type="file" en utilisant la méthode document.createElement() :
Exemple
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Propriétés de l'objet FileUpload d'entrée
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 |
Propriétés et événements standard
L'objet Input FileUpload prend également en charge les propriétés et les événements standard .
Pages connexes
Tutoriel HTML : Formulaires HTML
Référence HTML : balise HTML <input>
Référence HTML : attribut de type HTML <input>