>
 





By default, the maximum size of a file to be uploaded to a server using the ASP.NET FileUpload control is 4MB. You cannot upload anything that is larger than this limit.

To change this size limit, you have to make some changes in the application's web.config:

<system.web>
  <httpRuntime  maxRequestLength="102400" executionTimeout="360"/>
</system.web>

maxRequestLength - Attribute limits the file upload size for ASP.NET application. This limit can be used to prevent denial of service attacks (DOS) caused by users posting large files to the server. The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET Framework 1.0/1.1 and "2097151" (2 GB) for .NET Framework 2.0.

executionTimeout - Attribute indicates the maximum number of seconds that a request is allowed to execute before being automatically shut down by the application. The executionTimeout value should always be longer than the amount of time that the upload process can take.

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!

Currently rated 4.3 by 9 people

  • Currently 4.333334/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Comments

September 24. 2009 21:05

Thanks sir. This post was very usefull to me.

Lagarto Rei | Reply

October 21. 2009 17:32

Pingback from topsy.com

Twitter Trackbacks for
        
        Limiting the File Upload Size in ASP.NET
        [bloggingdeveloper.com]
        on Topsy.com

topsy.com | Reply

October 22. 2009 17:34

Social comments and analytics for this post

This post was mentioned on Twitter by bloggingdev: Limiting the File Upload Size in ASP.NET - http://su.pr/7Digee

uberVU - social comments | Reply

December 5. 2009 10:24

You're really great..It really worked. I had no idea what to do.

V M Sreekanth | Reply

Add comment




(Will not be displayed!)