I need a way to upload large files (50+ MB) in my .net mvc3 website (hosted on Amazon). After trying to upload a large zip file (36.9MB) FireFox shows “The connection was reset” screen and FireBug shows “Aborted” under status.
Any ideas on how I could solve it?
Controller:
private void SaveFile(HttpPostedFileBase uploadedFile)
{
using (var file = System.IO.File.Create(Server.MapPath("/uploads/" + uploadedFile.FileName))
uploadedFile.InputStream.CopyTo(file);
}
Web.config:
<system.web>
<httpRuntime maxRequestLength="56320" executionTimeout="1500"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength= "10485760"/>
</requestFiltering>
</security>
</system.webServer>
The maxAllowedContentLength property is in bytes:
10485760 bytes = 10MB. So if you try to upload a file that is larger than 10MB you will fail.
Be consistent between your
maxRequestLengthwhich is in KB:which indicates a limit of 55MB and your
requestLimits. Like this: