I am trying to use the Krajee Bootstrap File Input to upload a file. I am using ASP.NET Core 2. Here is my HTML:
<input id="fileFileUpload" type="file" />
Here is my javascript code:
$("#fileFileUpload").fileinput({
showPreview: true,
uploadAsync: false,
uploadUrl: '/fileupload'
});
Here is my controller code:
[HttpPost]
public JsonResult Index(List<IFormFile> files)
{
// Do stuff
}
I am putting a breakpoint on my controller method and the breakpoint is being hit. However files
is empty. How can I retrieve the file that was uploaded?
The number one reason I can see for that code not work is that your input in not assigned a name.
Other then that you can follow this MSDN article.