Open In App

HTML | DOM Input FileUpload type Property

Last Updated : 29 Aug, 2022
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+


Similar Reads

HTML | DOM Input FileUpload value Property
The Input FileUpload value Property is used to returns the path or the name of the file selected with the element. This property is used to return the name of the selected file with a fake path in IE, Google Chrome, and Opera, and return the name of the selected file in Firefox and Safari. This property is read-only, because of security reasons. Sy
1 min read
HTML | DOM Input FileUpload accept Property
The DOM Input FileUpload accept Property in HTML DOM is used to set or return the value of the accept attribute of the file upload button. The accept attribute specifies the types of files which are acceptable by that the server. Syntax: Return the accept property:fileuploadObject.acceptSet the accept property:fileuploadObject.accept="audio/*, vide
2 min read
HTML DOM Input FileUpload autofocus Property
The Input FileUpload autofocus property in HTML DOM is used to set or return whether a file upload button should automatically get focus when the page loads, or not. Syntax: Return the autofocus property:fileuploadObject.autofocusSet the autofocus property:fileuploadObject.autofocus=true|false Property Values: true: The file upload button get focus
2 min read
HTML DOM Input FileUpload disabled Property
The Input FileUpload disabled property in HTML DOM used to set or return whether a file upload field must be disabled, or not. A disabled field is unusable and un-clickable. It is a boolean attribute and used to reflect the HTML Disabled attribute. It is usually rendered in grey color by default in all the Browsers. Syntax: Return the disabled prop
2 min read
HTML | DOM Input FileUpload form Property
The Input FileUpload form property in HTML DOM is used to return a reference to the form containing the file upload button. This is a read-only property and returns a form object on success. Syntax: fileuploadObject.form Return Values: It returns a string value which specify the reference of the form containing the Input fileUpload field Example: C
1 min read
HTML | DOM Input FileUpload files Property
The Input FileUpload files Property in HTML DOM is used to return a FileList object, representing one or multiple files selected with the file upload button and This is a read-only property. Through the FileList object, you can get the information about the files.Syntax: fileuploadObject.files Return Values : It returns a FileList object which repr
2 min read
HTML | DOM Input FileUpload name Property
The name property is used to set or return the value of the name attribute of a file upload button. The name attribute is used to identify form data after the submission to the server. Syntax: Return the name property:fileuploadObject.nameSet the name property:fileuploadObject.name=name Property Values: name: Specifies the name of the file upload b
1 min read
HTML | DOM Input FileUpload required Property
The Input FileUpload required Property is used to set or return whether a file in the file upload field must be selected/uploaded before submitting a form. This property reflects the HTML required attribute. Syntax: Return the required property:fileuploadObject.requiredSet the required property:fileuploadObject.required=true|false Property Values:
2 min read
HTML DOM Input FileUpload multiple Property
The Input FileUpload multiple Property in HTML DOM is used to set or return one or multiple files selected with the file upload button. It contains a Boolean value which is true when the user is allowed to select more than one file. This property is used to reflect the HTML multiple attributes. Syntax: It returns the Input FileUpload multiple prope
2 min read
HTML | DOM Input FileUpload Object
The DOM Input FileUpload Object represents the input type of HTML forms i.e "file". This is used to enable the user side functions of uploading a File onto the website. Syntax: document.getElementById("ID") The 'ID' will be assigned to the input element. Property Values: accept: This property is used to Set or return the value of the accept attribu
3 min read
Article Tags :