Eddie Eddie - 4 months ago 29
C# Question

How to increase the max upload file size in ASP.NET?

I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default.

I have found in certain places referencing the below code at msdn.

[ConfigurationPropertyAttribute("maxRequestLength", DefaultValue = )]

None of the references actually describe how to use it, and I have tried several things with no success. I only want to modify this attribute for certain pages that are asking for file upload.

Is this the correct route to take? And how do I use this?


This setting goes in your web.config file. It affects the entire application, though... I don't think you can set it per page.

    <httpRuntime maxRequestLength="xxx" />

"xxx" is in KB. The default is 4096 (= 4 MB).