For creating a file dialog box using JavaScript, I utilized the following code:
var input = $(document.createElement('input'));
input.attr("type", "file");
input.trigger('click');
The file dialog box displays correctly with this code.
If a file is selected using the Open button on the File Dialog box, how can I capture the file name and other details?
I aim to upload the selected file to a server using an ajax request once it has been selected. Here are some of the methods I have attempted to detect when the Open button is clicked, but they have not yielded any results. Any recommendations?
input.onchange = function(e) {
alert("File Selected");
};
input.onclick = function(e) {
alert("File Selected");
};