views:

3655

answers:

4

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?

+5  A: 
Stefan
+4  A: 

I hate to refer to my own employer's web site but here is a link you may find useful: http://www.telerik.com/help/aspnet-ajax/upload_uploadinglargefiles.html

korchev
+3  A: 

I believe this line in the web.config will set the max upload size:

<system.web>

     <httpRuntime maxRequestLength="600000"/>
</system.web>
ben
+9  A: 

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

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>

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

Eric Rosenberger
This got me working for site wide. I set it to 10240 (or 10 MB) for now. Thanks!
Eddie