Is there any chance to detect every file selection the user made for an HTML input of type file element?
This was asked many times before, but the usually proposed onchange event doesn’t fire if the user select the same file again.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Set the value of the
inputtonullon eachonclickevent. This will reset theinput‘s value and trigger theonchangeevent even if the same path is selected.Note: It’s normal if your file is prefixed with ‘C:\fakepath’. That’s a security feature preventing JavaScript from knowing the file’s absolute path. The browser still knows it internally.