Synergy
THE COMPANY . CONTACT
Home > Blog > MOSS Blog > Posts > Working with File Upload Size Limitations

 Posts

Working with File Upload Size Limitations
Randy Williams

As a document management platform, SharePoint provides a number of useful features such as check-in, check-out and version control. One of SharePoint's basic document management settings is the maximum file size that can be stored. This value is set within SharePoint Central Administration (Application Management Tab à SharePoint Web Application Management) as shown here:

The 50MB size as you see is the default value and applies to the web application you've selected. What you may not realize is increasing this default will not work in all cases. For example, if you set the maximum to 75MB and then try to upload a 60MB file as an attachment to a list, you'll get the not-to-helpful "unexpected error" message:

The same file will upload correctly to a document library, however. You might be curious why the max seems to apply to libraries but not lists. At least I was, so I did a little investigation. My first test was to verify that the maximum does actually apply to both list attachments and library files. So I set the maximum upload size to 20MB and tried to upload a 25MB file to both a library and a list. It failed in both cases. Ok, so the max setting seems to work in some cases.

It was at this point that I remembered that ASP.NET also enforces a maximum amount when posting to the server. This is controlled inside the web.config file by the maxRequestLength attribute for the <httpRuntime> element. So I opened up the web.config and found this value:

<httpRuntime maxRequestLength="51200" />

The 51200 value is the max number of KB allowed which equals 50MB. This means that ASP.NET prevents any file posted that is larger than 50MB. Interesting. Now I was really curious and still asked the question, "How come it works for a document library?" I got my answer when I noticed the upload.aspx application page comes from the _layouts virtual directory. This folder (by default, C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS) has its own web.config file that can override the default web.config settings for the web application. Sure enough, this file had a different value for this page as shown here:

<location path="upload.aspx">
  <system.web>
    <httpRuntime maxRequestLength="2097151" />
  </system.web>
</location>

This is how the upload page gets around the maximum imposed by all pages inside the web application.

So, the lesson learned is that if you will be using large attachments inside a list item, you must also increase the maxRequestLength inside the web.config for the web application. When I did this, the behavior for both list and library file uploads was the same.

Comments

Great Stuff!

I ran into these issues and it helped alot!
at 7/10/2008 9:17 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title *


Body *


Posted By *


Attachments

Phone Number CLIENT LOGIN . CHANGE LOCALE . LIVE MEETING LOGIN . BLOG . PRIVACY POLICY . SITE MAP