Javascript Reference - HTML DOM Input FileUpload type Property








The type property returns type of the file upload button.

Browser Support

type Yes Yes Yes Yes Yes

Syntax

var v = fileuploadObject.type 

Return Value

Type Description
String The type of the file upload button




Example

The following code shows how to get the type of the file upload button.


<!DOCTYPE html>
<html>
<body>
<!--   ww w  .  j av a2  s  .c o m-->
Select a file to upload:
<input type="file" id="myFile">
<button onclick="myFunction()">test</button>
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myFile").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: