Skip to content
Related Articles

Related Articles

Improve Article
HTML | DOM Input FileUpload type Property
  • Difficulty Level : Basic
  • Last Updated : 20 May, 2021

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
  • Mozilla Firefox
  • Edge 10.0
  • Opera
  • Apple Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :