Reputation: 3
I tried to implement a simple file upload with ajax and progressbar to my mvc 4.0 controller with VS2013 and .net Framework 4.5
Uploads up to 4MB work as expected, but more than 4MB doesn't work! The Controller method is called but Request.Files is empty then!
If I try files bigger than the maxAllowedContentLength the request fails as expected.
Here is my code:
Client side solution found on http://www.matlus.com/html5-file-upload-with-progress/#codeListing6
Server Side solution self implementet:
[HttpPost]
public JsonResult Upload()
{
var name = Request.Files[0].FileName;
var result = new {};
return Json(result, JsonRequestBehavior.AllowGet);
}
Web.config:
...
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
...
Upvotes: 0
Views: 274
Reputation: 6398
Try this in web config
<system.web>
<httpRuntime maxRequestLength="2147483647" executionTimeout="1100" />
</system.web>
Upvotes: 1