Share via


SharePoint 2010: Uploading Large Files to SharePoint


*"The issue with very large files being uploaded through any browser based API are: *

  1. Reliably transferring gigabyte or bigger files without breakages over a protocol like HTTP, which is better suited for tiny transfers like images and text.

  2. Not killing your browser because it has to load all that in memory

  3. *Not killing your web server because,

    All that you upload through HTTP post, first gets streamed into IIS Memory, w3wp.exe memory before the ENTIRE FILE finishes uploading before it is stored. Which means,
            *

    • You cannot show an accurate and live progress bar of the upload, IIS gives you no such accurate metric of an upload. All the counters it gives you are approximate.
    • Your w3wp.exe eats up all server memory – 4GB of it, for a 4GB upload.
    • A thread is kept busy for the entire duration of the upload, thereby greatly limiting your web server’s capability to serve newer requests.
    • *Kills effective load balancing.
      *
  4. Not killing your content database because,

**
Issues with uploading large documents to a document library
** 
To begin with, the Support for Large Files was one of the enhancements made in Windows SharePoint Services SP 1. By default, the maximum size for uploading files is set to 50 MB. The maximum file size that it can go up to is 2,047 megabytes (2 GB).
 
Though SharePoint is meant to handle files that are up to 2 gigs in size, it is not practically feasible and not recommended as well.
 
However, there are circumstances where files of much smaller size fail to upload which makes one wonder as to what could be the reason, and hence this article. Below are the common error messages that you may encounter while trying to upload large files based the operation system and the version of IIS.
 
WSS 3.0 or MOSS on a Windows 2003 server; when we upload any document larger that 50 Mb on any document library, we get an error message as:

"An unexpected error has occurred"
 
WSS 3.0 or MOSS on Windows Server 2008 ; when we upload any document larger that 28 Mb on any document library, we get the error message as:

"The page cannot be displayed." In some circumstances, we may also get a "HTTP 404 - Page not found" error.
 
This can occur due to various reasons and this post lists a few of the possible causes and the workarounds for them.

**WORKAROUND(s)
**

  1. Increase the Maximum Upload Size for the Web Application from Central Administration site

    • Browse to Central Administration site and click on Application Management
    • Click on 'Web Application General Settings' under 'SharePoint Web Application Management ' and choose the appropriate web application
    • Modify the value for 'Maximum Upload Size' property to specify the maximum size which is allowed for a single upload to any site under the web application.
      Note: You can choose multiple files and folders to be uploaded provided no single file or the collective size goes beyond 2 GB
    • A value of '1000' would set the max upload size to 1 GB. The maximum upload size cannot be increased beyond '2000' (2 Gb)
    • The default file size for upload is 50 Mb in IIS 6.0) and 28 Mb for IIS 7.0.

     

  2. Increase the connection time-out setting in IIS

    By default, the IIS connection time-out setting is 120 seconds (2 minutes). Follow these steps to increase the connection time-out setting:

    • In IIS manager, expand the 'Sites' node and select the SharePoint site
    • Click 'Advanced Settings' from the actions pane OR right-click the SharePoint site, Manage Web site and click 'Advanced Settings'
    • Increase the 'Connection time-out' value (seconds); under 'Connection limits' from the 'Advanced Settings' dialog box to avoid IIS time-outs when large files are being uploaded
    • You can specify the time-out value based on file size and the time taken for the file to be uploaded
    • You can also select the SharePoint site in IIS and click on the 'Limits' link in the actions pane.    
                     
  3. Increase the maximum upload size in the web.config file of web application

    The maxAllowedContentLength property specifies the maximum length of content in a request in bytes and it needs to be set on a Windows Server 2008 computer that has IIS 7.0-only installations.

    To change the value of the property via web.config, do the following:

    Open the web.config file of a web application located in %Inetpub%\Wwwroot\Wss\VirtualDirectories\Virtual Directory> folder and add the following code at the bottom, just before the close out of the <configuration> section of the Web.config file

                <Configuration>
                ..
                ..
                <system.webServer>
                    <Security>
                            <RequestFiltering> 
                                       <requestLimits maxAllowedContentLength”52428800’/> 
                            </requestFiltering>
                    </security>
                </system.webServer>
                </configuration>

     This sets the value of the maxAllowedContentLength property to 52428800 (in bytes) for the web application only.

     To change the value of the property via command-line, do the following:   

    • Open command prompt and go to 'C:\windows\system32\inetsrv' directory

    • Run the below command:        

      Appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:unit
             
      Where the variable requestlimits.maxallowedcontentlength unit specifies the maximum length of content (in bytes). For example, to specify 2000000000 as the maximum length of content, type the following at the command prompt, and then press ENTER:

      Appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:2000000000      

     

  4. Increase the default chunk size for large files
               
    The large-file-chunk-size property sets the amount of data that can be read from server running SQL Server at one time. Points to remember:            

    • If you have a file that is greater than your chunk size (such as 100 MB when the chunk size is set to 5 MB), the file would be read in 20 chunks (100 / 5).
    • The chunk size is not related to the maximum upload file size.
    • The chunk size simply specifies the amount of data that can be read from a file at one time. By default, the large-file-chunk-size property is set to 5 MB.
    • Be aware that if you set the chunk size too high, the files might use a high amount of memory of the web front-end.

    In order to set the large–file–chunk–size property, we need to use the command line. This property is configured at a server or server farm level, and cannot be configured for an individual web application. To set this property, use the following syntax:

    Stsadm.exe –o setproperty –pn large–file–chunk–size –pv <size in bytes>
                   

  5. Add the ExecutionTimeout Value in the web.config

    • "12\TEMPLATE\LAYOUTS" folder
       
      Open the 'Web.config' file from the 'C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\TEMPLATE\LAYOUTS' directory. Add the executionTimeout value that you want. For example, replace the value as follows

      Existing code

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

      Replacement Code

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

    • Web App

      Open the web.config file located at 'C:\Inetpub\wwwroot\wss\VirtualDirectories\ folder and modify it as follows
         
      Existing line:             <httpRuntime maxRequestLength="51200" />            
      Replacement line:     <httpRuntime executionTimeout="999999" maxRequestLength="51200" />            
         

    • "12\CONFIG"
       
      Open the web.config located at "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG" and modify the 'maxRequestLength' property which by default should be the following:

       <httpRuntime maxRequestLength="51200"/>    

      Change the value to match the other web.configs          

       

  6. Save the file and perform an ' IISreset /noforce'.

**Large file support limitations
 
The following features do not support files larger than 50 MB 
**

  • Virus checking.
  • Picture libraries.
  • Streaming files.
  • Client-side restoration of smigrate backup files (limited to 2 GB). The manifest files for an smigrate backup cannot be larger than 2 GB.
  • Site templates (limit of 10 MB per site template, including content)      

 
See Also