I just checked all options to reset/clean <input type='file' />
based on
Clearing <input type='file' /> using jQuery
And all of them are not working.
What I do in my page is submit new file and update page in a normal way.
HTML
<form>
<input type="file" name="file" id="fileUploader" class="btn btn-sm btn-default" />
</form>
And then I have AJAX link to delete uploaded file. So I delete it in Session and in AJAX callback do like
//Reset
var uploader = $("#fileUploader");
window.reset = function (uploader) {
e.wrap('<form>').closest('form').get(0).reset();
e.unwrap();
}
uploader.reset();
// Clear all file fields:
// $("input:file").clearInputs();
// Clear also hidden fields:
//$("input:file").clearInputs(true);
//$row.replaceWith($row = $row.val('').clone(true));
But after this when I do F5 / Update HttpPost happens and it has posted file.
How to fix it?
P.S. And even if I do the following no joy...
$('#inputFileForm').html("");
$('#inputFileForm').append(
// <input type="file" name="file" id="fileUploader" class="btn btn-sm btn-default" />
$('<input/>').attr('type', 'file').attr('name', 'file').class("btn btn-sm btn-default")
);
<input>
is not empty?