Reputation: 481
@Html.TextBoxFor(m => m.file, new { type = "file", id = "policyFile", @class = "ace-file-input" })
$('#policyFile').ace_file_input({
no_file: 'No File ...',
btn_choose: 'Choose',
btn_change: 'Change',
droppable: false,
onchange: null,
thumbnail: false
});
Now i am using $("#policyFile").val("");
but not reset the control value
Upvotes: 0
Views: 1609
Reputation: 82
Browsers don't allow modifications or clear operations to be performed on the file type input for security reasons. The trick is to clone the control.
var control = $("#policyFile");
control.replaceWith( control = control.clone( true ) );
The above code will replace your control with a replica of it. This will create a new file type input with the same attributes in place of already existing file input. Hope this helps. Let me know if it worked out.
Upvotes: 1