I'm using the HTML5 File API features to create beatiful file uploader for my website.
But I've got some problems with the server side (where I use ASP.NET MVC 4).
I couldn't see any file data at the breakpoint in VS, it's just always equaled to the null
value. Breakpoint is firing (so by this logic, there is a request), but there isn't any data.
I've read that for the argument it the POST method, which does accept a file must be the idential ID value, which was set in HTML markup of your uploader page.
Let's look at my code:
Server-side:
[HttpPost]
public ActionResult Upload(HttpPostedFileBase fileData)
{
if (fileData != null && fileData.ContentLength > 0)
{
var fileName = System.IO.Path.GetFileName(fileData.FileName);
var path = System.IO.Path.Combine(@"C:\tmp", fileName);
fileData.SaveAs(path);
}
return RedirectToAction("../NewContract/Strict");
}
Client side (mark-up):
Client side (JS):
How can I fix my issue?