Okay, so there are two different ways you can try to solve this problem:
The first solution is to change the input type before you submit and then change it back after you get the response back. The main advantage of this solution is that any functions bound to that input will work when we change it back. The main disadvantage of this solution is that it won’t work in all browsers, so unless you’re only using Firefox, this solution won’t work.
The second solution is to remove the entire file input and then add it back after the response. The main advantage of this solution is that it will work in all browsers. The main disadvantage of this solution is that you’ll have to rebind any functions previously bound to the input.
Below, I’ve summed up the advantages and disadvantages of each solution:
|Changing Input File Type||Bound function will continue to work when input file is changed back.||Won’t work in all browsers.|
|Removing Input File||Will work in all browsers.||Must rebind functions after input file is added back.|