HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The Input FileUpload object represents an HTML <input> element with type=file"
The Input FileUpload object represents an HTML <input> element with type="file".
Access an Input FileUpload Object
You can access an <input> element with type="file" by using getElementById():
var x = document.getElementById("myFile");
Create an Input FileUpload Object
You can create an <input> element with type="file" by using the document.createElement() method:
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Property | Description |
---|---|
accept | Sets or returns the value of the accept attribute of the file upload button |
autofocus | Sets or returns whether a file upload button should automatically get focus upon page load |
defaultValue | Sets or returns the default value of the file upload button |
disabled | Sets or returns whether the file upload button is disabled, or not |
files | Returns a FileList object that represents the file or files selected with the file upload button |
form | Returns a reference to the form that contains the file upload button |
multiple | Sets or returns whether a user is allowed to select more than one file in the file upload field |
name | Sets or returns the value of the name attribute of the file upload button |
required | Sets or returns whether a file in the file upload field must be selected before submitting a form |
type | Returns which type of form element the file upload button is |
value | Returns the path or the name of the selected file |
The Input FileUpload object also supports the standard properties and events.
HTML tutorial: HTML Forms
HTML reference: HTML <input> tag
HTML reference: HTML <input> type attribute