HTML DOM इनपुट फ़ाइलऑब्जेक्ट अपलोड करें
इनपुट फ़ाइलअपलोड वस्तु
इनपुट फ़ाइल अपलोड ऑब्जेक्ट एक HTML <इनपुट> तत्व का प्रतिनिधित्व करता है जिसमें type="file" होता है।
एक इनपुट फ़ाइल तक पहुँचेंऑब्जेक्ट अपलोड करें
getElementById() का उपयोग करके आप टाइप = "फ़ाइल" के साथ <इनपुट> तत्व तक पहुंच सकते हैं:
उदाहरण
var x = document.getElementById("myFile");
युक्ति: आप किसी प्रपत्र के तत्वों के संग्रह के माध्यम से खोज कर <input type="file"> तक भी पहुंच सकते हैं ।
एक इनपुट फ़ाइल बनाएँऑब्जेक्ट अपलोड करें
आप document.createElement() विधि का उपयोग करके type="file" के साथ एक <input> तत्व बना सकते हैं:
उदाहरण
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
इनपुट फ़ाइलऑब्जेक्ट गुण अपलोड करें
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 |
मानक गुण और घटनाएँ
इनपुट फ़ाइल अपलोड ऑब्जेक्ट मानक गुणों और घटनाओं का भी समर्थन करता है ।
संबंधित पृष्ठ
एचटीएमएल ट्यूटोरियल: एचटीएमएल फॉर्म
HTML संदर्भ: HTML <इनपुट> टैग
HTML संदर्भ: HTML <इनपुट> प्रकार विशेषता