Friday, 24 February 2012

How to Increse the Upload size of a file in ASP.Net 2.0

Some it is there to Upload a File of higher size to the server, 
but .net 2.0 upload control doesn't allows it make it to take
higher file size just go your web config and find the <configuration>
then <System.web> and inside it write the code below. You need to change
the Execution time and maxRequestLength as per your need.
here the default file size it can take is of 4mb and the time out is of 90 
seconds.
Even if some one uploads file of more size it will throw the error.
So in your try catch block check <Fileupload Control ID >.PostedFile.ContentLenth not be
more than the maxRequestLength given in the <httpRuntime> of the web.config file of 
your project.
 <httpRuntime
executionTimeout = "110" [in Seconds][number ]
maxRequestLength = "4096" [number] 
requestLengthDiskThreshold = "80" [number]
useFullyQualifiedRedirectUrl = "false" [true|false]
minFreeThreads = "8" [number]
minLocalRequestFreeThreads = "4" [number]
appRequestQueueLimit = "5000" [number]
enableKernelOutputCache = "true" [true|false]
enableVersionHeader = "true" [true|false]
apartmentThreading = "false" [true|false]
requireRootedSaveAsPath = "true" [true|false]
enable = "true" [true|false]
sendCacheControlHeader = "true" [true|false]
shutdownTimeout = "90" [in Seconds][number]
delayNotificationTimeout = "5" [in Seconds][number]
waitChangeNotification = "0" [number]
maxWaitChangeNotification = "0" [number]
enableHeaderChecking = "true" [true|false]
/> 
Refer the links:
1) http://www.dotnetspark.com/kb/1269-file-upload-control-asp-net-with-codings.aspx 
2)http://msdn.microsoft.com/en-us/library/e1f13641%28v=vs.71%29.aspx

No comments:

Post a Comment