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
Post a Comment