Javascript examples for DOM HTML Element:Input FileUpload
The value property returns the path selected with the <input type="file"> element.
This property is read-only.
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:
<!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>