Objeto de carga de archivo de entrada HTML DOM
Objeto de carga de archivo de entrada
El objeto Input FileUpload representa un elemento HTML <input> con type="file".
Acceder a un objeto FileUpload de entrada
Puede acceder a un elemento <input> con type="file" usando getElementById():
Ejemplo
var x = document.getElementById("myFile");
Sugerencia: también puede acceder a <input type="file"> buscando en la colección de elementos de un formulario.
Crear un objeto FileUpload de entrada
Puede crear un elemento <input> con type="file" usando el método document.createElement():
Ejemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Propiedades del objeto Cargar archivo de entrada
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 |
Propiedades y eventos estándar
El objeto Input FileUpload también admite las propiedades y los eventos estándar .
páginas relacionadas
Tutorial de HTML: formularios HTML
Referencia HTML: etiqueta HTML <input>
Referencia HTML: atributo de tipo HTML <entrada>