Friday, February 03, 2006

File Upload Limit

Q: I’m using code very similar to that in this article (http://www.dotnetspider.com/technology/kbpages/568.aspx). The problem I have is when I try to upload a 9 MB file, I immediately get “Page cannot be displayed” error. Execution doesn’t even reach the PageLoad() event. The size limit for an IMAGE type in SQL Server 2000 is 2GB+, so size should not be a problem here. When I try the same function for files under 4MB, everything works as expected. What's the problem?

A: Your web application can only upload a file size of 4 MB only. To upload files more than 4mb you have to add option in the web.config file and set the maximum file size there.

In addition, if you're running IIS6, you could be hitting the limit for AspMaxRequestEntityAllowed. If the Content-Length header field of the HTTP request is larger than this limit, the page will bomb out immediately. You can increase the value in IIS6's metabase. For more info, goto
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/99b8a8bd-f9e7-43a8-b4cf-1186e2b3e9e2.asp

No comments: