I work on a VS2012 MVC4 project containing a Web API controller. This project will be published on an IIS server.
I need to allow users to upload files. The problem is a web API is limited up to 4MB maximum file size upload. I read (for example here: http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx) that we can extend this limitation by self hosting the web API (in this case file upload up to 2GB). I don't want self host my webAPI because I want to host it on my IIS web server so I think this is not suitable for my situation, right? So what can I do for uploading files bigger than 4MB?
If possible I search for an HTML5 solution (with drag'n drop).
So far none of the solutions I found allows me to accomplish this.
Thanks for your help.
The maximum size of the files for upload using the REST API is 100MB.
Probably it was not clear but actually the blog URL is referring to IIS. You need to look for the following 2 settings in Web.config to increase the upload size:
Note maxRequestLength
is in kbytes:
<system.web>
<httpRuntime targetFramework="4.5" maxQueryStringLength="" maxRequestLength="" maxUrlLength="" />
Note maxAllowedContentLength
is in bytes:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="" maxQueryString="" maxUrl=""/>
If you read it carefully, it says "ASP.NET has a maximum limit of 2G in terms of file size that you can upload." So basically when hosted in ASP.NET/IIS you will be able to receive files up to 2Gbs. What you have to do is change some default values in web.config.
Check this out: https://stackoverflow.com/a/7154363/2517785
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With