Thursday, November 12, 2009

Upload a large file using Fileupload control in asp.net

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:

in system.web change the following..

httpruntime executiontimeout="360" maxrequestlength="102400"

maxRequestLength - Attribute limits the file upload size for ASP.NET application.  The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET

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.

No comments:

Post a Comment