Input FileUpload value Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input FileUpload

Description

The value property returns the path selected with the <input type="file"> element.

This property is read-only.

Return Value

A String, representing the path or the name of the selected file

The following code shows how to Display the path or the name of the selected file:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Select a file to upload:
<input type="file" id="myFile" size="50">

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//  w  w w  .j a v a  2  s . c  o m
    var x = document.getElementById("myFile").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials