Open In App

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: 






<!DOCTYPE html>
<html>
<head>
    <style>
        h1 {
            color: green;
        }
    </style>
</head>
<body>
    <center>
        <h1>
              Geeks for Geeks
          </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: 


Article Tags :