Monday, May 25, 2009

Uploading filesize > 4MB using fileupload Control of ASP.Net

Problem:
While i try to upload .dat file which is more than 4MB i got one error message...

Reason:
In ASP.Net the default size of files uploaded by the FileUpload control is 4MB. So if you try to upload any file may be (.pdf, .doc, .wmv, dat..etc..) files larger than 4MB, it won't let you do so.

Solutions:
To do so, you need to change the default file size in machine.config.which is located in below pathC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG directory

//Add this code to machine.config file..
(use Left Anchor Brckt) httpRuntime
executionTimeout="90"
maxRequestLength="20000"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"/>

//or by adding one tag on web.config file
// Include the code below in your web application web.config

(use Left Anchor Brckt) system.web (use Right Anchor Brckt)
(use Left Anchor Brckt) httpRuntime executionTimeout="90"
maxRequestLength="20000"
useFullyQualifiedRedirectUrl="false"
requestLengthDiskThreshold="8192"/>
(left Anchor brkt) /system.web>

sorry to say this editor is not taking Anchor brackets so try to implement in code..




No comments:

Bookmark and Share