I am using infile to ask the users to browse for a file on their machine. Is there way to catch if the window is closed without file being selected?
For example if x is clicked.
<input type="file" name="data" id="inFile" size="15" style="display:none" onchange="handleFiles(this)"/>
Thanks
I think the
blur
event will do it:What I did is: Start timer after the user opens the window, and in that timed function I check every 0.5 sec if the file has been selected with boolean var. I stop the timer as soon as user selects the file or HTML5 DnD occurs. I hope this helps someone.
With the solution from HTML input file selection event not firing upon selecting the same file, I think you can use this: