HTML DOM Girişi Dosya Yükleme Nesnesi
Dosya Yükleme Nesnesini Girin
Input FileUpload nesnesi, type="file" içeren bir HTML <input> öğesini temsil eder.
Bir Girdi Dosya Yükleme Nesnesine Erişme
getElementById() kullanarak type="file" ile bir <input> öğesine erişebilirsiniz:
Örnek
var x = document.getElementById("myFile");
İpucu: Bir formun öğe koleksiyonunda arama yaparak da <input type="file"> öğesine erişebilirsiniz .
Bir Girdi FileUpload Nesnesi Oluşturun
Document.createElement() yöntemini kullanarak type="file" ile bir <input> öğesi oluşturabilirsiniz:
Örnek
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Dosya Yükleme Nesnesi Özelliklerini Girin
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 |
Standart Özellikler ve Etkinlikler
Input FileUpload nesnesi, standart özellikleri ve olayları da destekler .
İlgili Sayfalar
HTML öğreticisi: HTML Formları
HTML referansı: HTML <input> etiketi
HTML referansı: HTML <input> tipi özniteliği