Alternate to onchange event in <input type='file' />

You could have the choose file button clear the contents of the input onclick, that way even even if they choose the same file your event will still trigger. Of course, then your onchange handler will have to check for blank values, but it should probably be doing something similar or more anyway if it's going to use that value to upload a file...


You can just remove the input and create an identical one with javascript - the new one will be empty.

(edited answer to be straight to the point, comments are irrelevant now)


There really isn't any way to fix that. If you add any other listener or timer, then you will potentially upload the file even when the user doesn't want it to (eg, with an onclick). Are you sure uploading the same file can't be done in another way? What about clearing the input once the upload has started (or replace it with a new input if you can't clear it).


You could not fire change event second time on the file input, but you can fire change event on the span. Below works in chrome and ff. I didn't check in IE. $('#change_span').bind('change',function(){ alert($('#file_1').val()) })

<span id='change_span'><input id="file_1" type="file"></span>