There is an HTML code:

<form> <input id="f_fileDoc" name="fileDoc" type="file"/> </form> 

And JavaScript + jQuery :

 $("#f_fileDoc").change(function () { var fileName = $(this).val(); alert(fileName); }); 

It works only if the next file selected is not the same as the previous one. I would like to make some bugfix with multiple identical choice.

  • And what exactly should happen? What is the final expected result? - NeedHate 2:42 pm
  • Maybe it makes sense just to clear the value of val when clicked? $ ("# f_fileDoc"). click (function () {fileName.val ('')}); - NeedHate pm
  • @NeedHate the final result I need to process all the files that the user selected, even if he selected the file for the first time, and then selected it again. If he selects 2 different files, then it is processed normally. I'm afraid the DOM object will not let me change the val input file. Browser protection will work. I'll try tomorrow. - Dmitry Chistik

1 answer 1

May help someone:

 $("#f_fileDoc").change(function () { var fileName = $(this).val(); alert(fileName); $("#f_fileDoc").parent().html($("#f_fileDoc").parent().html()); });