HTML | DOM Input FileUpload type Property
The Input FileUpload type Property is used in HTML DOM to return the type of form element the file upload button is. This property will always return “file” for a file upload button.
Syntax:
fileuploadObject.type
Return Value: It returns a string value that represents the type of form element the file upload button is.
Examples:
HTML
<!DOCTYPE html> < html > < head > < style > h1 { color: green; } </ style > </ head > < body > < center > < h1 > Beginner for Beginner </ h1 > < input type = "file" id = "myFile" required> < p id = "demo" ></ p > < button onclick = "myFunction()" > Click </ button > < script > function myFunction() { var x = document.getElementById( "myFile").type; document.getElementById( "demo").innerHTML = x; } </ script > </ center > </ body > </ html > |
Output:
Before:
After:
Supported Browsers:
- Google Chrome 1+
- Mozilla Firefox 1+
- Edge 12+
- Opera 11+
- Apple Safari 1+