Friday 2 November 2012

File Upload Max Lenght exeeded Error


The default setting for thr file upload control is 4MB we can overwrite in web.config.
If you are using IIS7 use both else  maxRequestLength is enough.

In system.web
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

And in system.webServer
<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
</security>
IMPORTANT: Both of these values must match. In this case, my max upload is 1024 megabytes.
maxRequestLength has 1048576 KILOBYTES, and maxAllowedContentLength has 1073741824 BYTES.
I know it's obvious, but it's easy to overlook.