javascript - Jquery File Upload Reset in Internet Explorer -


i using jquery in classic asp webform. form basic , uploads 5 files.

when uploading files have provided option users delete 1 of files being uploaded. jquery code have used

$('#delete_attachment').click(function() {     if (confirm('are sure want delete file?')) {     $('#file_format').val('');//this textbox , works fine     $('#document_attachment').val('');//this line deletes file     $('#document_comment').val('');//this textbox , works fine     }     }); }); 

this works fine in chrome , file removed. in internet explorer, file remains , gets uploaded. there other way avoid file being uploaded , delete upload que using regular html file-upload control

you can't change value of file input type, because introduce security vulnerability.

instead of $('#document_attachment').val(''); can do:

$('#document_attachment').replacewith('<input name="file" type="file" id="document_attachment"/>');


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -