I use Bootstrap File Input in an ASP.NET MVC5 application as explained on Uploading a File (Or Files) With ASP.NET MVC.
View:
<input type="file" name="files" id="file1" >
<a href="javascript:;" id="file1Remove" class="btn red fileinput-exists" data-dismiss="fileinput"> Remove </a>
<input type="file" name="files" id="file2" >
<a href="javascript:;" id="file2Remove" class="btn red fileinput-exists" data-dismiss="fileinput"> Remove </a>
<input type="file" name="files" id="file3" >
<a href="javascript:;" id="file3Remove" class="btn red fileinput-exists" data-dismiss="fileinput"> Remove </a>
Controller:
public ActionResult Insert([Bind(Exclude = null)] IEnumerable<HttpPostedFileBase> files)
{
...
}
I can post the images properly to the Controller via AJAX, however when I remove or change an image the other images are posted to the Controller null as shown below (in this scenario I selected 3 photos and then remove one of them before submitting form). Does anybody know how to fix it?