Friday, December 19, 2003

Size limit while uploading files ...

Couple of weeks back, one of my friend who was working on a file upload page told me that his page throws an exception when a *huge* file is uploaded. Hope many of us would have faced similar situation previously!!!

The default limit in the size of file upload is 4 MB. This default setting can be overridden by making some minor changes to our Machine.config. In the configuration file we need to change the value for the attribute "MaxRequestLength" in the section "httpRuntime".

By default httpRuntime section in machine.config would look as follows:


Here, change the value of "maxRequestLength" as per your requirement. Beware from now on machine wide the new value would be the default limit for all ASP.NET application.

On the flip side, if you want the size limit to be changed for a particular project then copying that section from machine.config and pasting it in web.config would do the trick.

No comments: