We would like to know how to get the file selected or input by the user for file upload input box.
<!-- w w w . j a v a2s . co m-->
<html>
<body>
<script language="JavaScript">
function showFile(){
var input = document.form1.uploadbox.value;
console.log("The filename entered is: " + input);
}
</script>
<form name="form1">
Please select a file.
<input type="file" name="uploadbox">
<br><br>
Click on the button to see the value of the FileUpload object.
<br>
<input type="button" value="Submit" onClick=showFile()>
</form>
</body>
</html>
The code above is rendered as follows: