0
@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

ssilas777
  • 9,672
  • 4
  • 45
  • 68
Deependra Singh
  • 441
  • 1
  • 4
  • 10

1 Answers1

1

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.

Vipin Nair
  • 82
  • 2
  • 6