I am mostly new to web development and run into a problem with open file dialog box
using JavaScript
or jQuery
. My problem is that I can open the file browser dialog box
and after clicking the open
button in the file dialog box
get the path
or name
file in alert()
.
I am using below code for show dialog box in JavaScript
<script type="text/javascript"> function performClick(node) { var evt = document.createEvent("MouseEvents"); evt.initEvent("click", true, false); node.dispatchEvent(evt); var pathnew = document.getElementById('theFile').value; } </script> <a href="#" onclick="performClick(document.getElementById('theFile'));">Open file dialog</a> <input type="file" id="theFile" />
The above code shows the perfect file view dialog box, but this warning window is displayed when I click on the Open file dialog
, but I need to click on the "Open" button, which is located in the "View files" dialog box. Please help me!
Any help would be awarded!
source share