FileUpload typeProperty
FileUpload Object
Definition and Usage
The type property returns the form element type of the FileUpload object.
For a FileUpload object, this property returns "file".
Syntax
fileuploadObject.type
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the type property
Example
Example
Display the type of the form element of the FileUpload object:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
`<title>Example Tutorial (example.com)</title>`
<script>
function displayResult(){
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
Choose a file to upload:
<input type="file" id="fname">
</form>
`<button type="button" onclick="displayResult()">Display input types</button>`
</body>
</html>
<html>
<head>
<meta charset="utf-8">
`<title>Example Tutorial (example.com)</title>`
<script>
function displayResult(){
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
Choose a file to upload:
<input type="file" id="fname">
</form>
`<button type="button" onclick="displayResult()">Display input types</button>`
</body>
</html>
Try it yourself »
FileUpload Object Other Extensions