Open In App

HTML | DOM Input FileUpload type Property

Improve
Improve
Like Article
Like
Save
Share
Report

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>
              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: 

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Edge 12+
  • Opera 11+
  • Apple Safari 1+


Last Updated : 29 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads