Reputation: 59
When I tried to Upload my exel file it gives error.
CODE
[HttpPost]
public ActionResult myAction(HttpPostedFileBase file, FormCollection form)
{
file.SaveAs(Server.MapPath("~/ExcelTemplates/" + file.FileName));
}
Upvotes: 0
Views: 687
Reputation: 592
Kill EXCEL.exe process from task manager. I hope it will work for you.
Upvotes: 1
Reputation: 5729
Save the file with a new name, may be it is still handled by the browser if you have tried to upload before.
btw it is recommended to rename uploaded files and use the file name only for display purpose, see the docs here: https://learn.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-2.2
additionally you may see this file upload sample on GitHub using dropzone
Upvotes: 1