Click here to Skip to main content
15,921,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hallo,

I am currently having a problem with a file upload element. I am using Visual Studio 2010 Express.
If I try to upload a large file (~ 4 MB), nothing happens. Instead "this page cannot be displayed" is shown, as if there were connection issues.
It does work fine for smaller files.
When debugging, I found out that not even the first line of the upload button event handler is called.

Can someone help me?

Thanks
Posted
Comments
Balakrishnan Dhinakaran 5-Dec-11 8:37am    
Can you able to Share your code..

 
Share this answer
 
That's because By default asp.net allows u to upload a file of maximum size 4096kb.

u need to do changes in your web.config

add
<httpruntime></httpruntime>


node in web.config

and set maxRequestLength to whatever the max size of the file you need to upload in bytes.
<httpruntime maxrequestlenght="8192" executiontimeout="400" />


maxRequestLenght is the max size of the file u want to upload.

this should do the trick for you However it's a good practice if u upload your large file by dividing it into pieces and joining the pieces at server.
 
Share this answer
 
v2
To change this size limit, you make some changes in either the web.config.comments (found in the ASP.NET 2.0 configuration folder at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) or your application's web.config file.

In the web.config.comments file, find a node called <httpRuntime> that looks like the following:
Copy
SQL
<httpRuntime
 executionTimeout="110"
 maxRequestLength="4096"
 requestLengthDiskThreshold="80"
 useFullyQualifiedRedirectUrl="false"
 minFreeThreads="8"
 minLocalRequestFreeThreads="4"
 appRequestQueueLimit="5000"
 enableKernelOutputCache="true"
 enableVersionHeader="true"
 requireRootedSaveAsPath="true"
 enable="true"
 shutdownTimeout="90"
 delayNotificationTimeout="5"
 waitChangeNotification="0"
 maxWaitChangeNotification="0"
 enableHeaderChecking="true"
 sendCacheControlHeader="true"
 apartmentThreading="false" />
 
Share this answer
 
v2
Comments
RaviRanjanKr 5-Dec-11 9:11am    
Normal texts removed from pre tag.
You can increase the limit of length of uploaded file by using the following code into your web.config file in your website.
You have to add this tag after the system.web of your web.config file...
<httpruntime maxrequestlength="20480" executiontimeout="600">
</httpruntime>

Using that code you can upload files which are more than 20MB in size.
I hope it will help you. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900