Objeto de upload de arquivo de entrada HTML DOM
Objeto FileUpload de entrada
O objeto Input FileUpload representa um elemento HTML <input> com type="file".
Acessar um objeto FileUpload de entrada
Você pode acessar um elemento <input> com type="file" usando getElementById():
Exemplo
var x = document.getElementById("myFile");
Dica: Você também pode acessar <input type="file"> pesquisando na coleção de elementos de um formulário.
Criar um objeto FileUpload de entrada
Você pode criar um elemento <input> com type="file" usando o método document.createElement():
Exemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Propriedades do objeto FileUpload 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 |
Propriedades e eventos padrão
O objeto Input FileUpload também suporta as propriedades e eventos padrão .
Páginas relacionadas
Tutorial HTML: Formulários HTML
Referência HTML: tag HTML <input>
Referência HTML: atributo de tipo HTML <input>