Easy Tutorial
❮ Prop Audio Loop Prop Style Marginright ❯

FileUpload name Attribute


Definition and Usage

The name attribute sets or returns the value of the name attribute of a FileUpload object.

The name attribute is used to send data to the server after form submission or to reference form data in JavaScript.

Note: Only the name attribute of form elements is used to pass data values after form submission.

Syntax

Set the name attribute:

Return the name attribute:


Browser Support

All major browsers support the name attribute.


Example

Display the name attribute value of the input element:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function displayResult(){
    var x=document.getElementById("fname").name;
    alert(x);
}
</script>
</head>
<body>

<form>
Select a file to upload:
<input type="file" name="filename" id="fname" size="50"/>
</form>
<button type="button" onclick="displayResult()">Display Name</button>

</body>
</html>

❮ Prop Audio Loop Prop Style Marginright ❯