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:
HTML
<!DOCTYPE html>
< html >
< head >
< title >
DOM Input FileUpload form Property
</ title >
</ head >
< body >
< center >
< h1 style = "color:green;" >
GeeksForGeeks
</ h1 >
< h2 >
DOM Input FileUpload form Property
</ h2 >
< form id = "gfgForm" >
Select a file to upload:
< input type = "file"
id = "myFile" >
</ form >
< button onclick = "myFunction()" >
Click
</ button >
< p id = "demo" >
</ p >
< script >
function myFunction() {
var frmid =
document.getElementById(
"myFile").form.id;
document.getElementById(
"demo").innerHTML = frmid;
}
</ script >
</ center >
</ body >
</ html >
|
Output:
Before:

After:

Supported Browsers: The browser supported by DOM Input FileUpload form Property are listed below:
- Google Chrome 1+
- Edge 12+
- Firefox 1+
- Opera 11+
- Safari 1+