Sitecore Media Library Upload Errors

Applies to: Sitecore 6.X, IIS 7 and Higher

Solution Tested On : OS : Windows 7, Browser :IE 9 , IE 8 , Chrome (18.0.1025.162 m) and Mozilla Forefox (11.0).

Introduction

This post deals with the problems encountered while uploading media items in Sitecore Media Library. The first scenario deals with users who were unable to upload files which are larger than 15MB.while the second scenario deals with users unable to upload files specifically larger than 30MB. The interesting part of the second scenario is although we increased the MaxSizeInDatabase setting to accommodate files larger than 30MB in media library, it was still failing. Below I have described both the Problem and Solution for the two scenarios. I would also recommend going through the Caution Points as it deals with the effects of changing the values in web.config.

Problem Scenario 1:

 In Sitecore Media Library, if a user tries to upload any file which is larger than 15MB (using either basic or advanced upload). The Sitecore media library prompts an error saying that the file is too big to be uploaded.

 

Solution:

In default sitecore installations the maximum limit of a file which can be uploaded is 15MB and is governed by the setting below which can be found in web.config file,

<setting name=”Media.MaxSizeInDatabase” value=”15MB” />

Note: The maximum allowed size of media intended to be stored in a database (binary blob).This value must be less than the ASP.NET httpRuntime.maxRequestLength setting

 <httpRuntime maxRequestLength=”16384″ executionTimeout=”600″ />

executionTimeout=”[seconds]” – time in seconds before request is automatically timed out maxRequestLength=”[Kbytes]” – Kbytes size of maximum request length to accept


Problem Scenario 2:

 In Sitecore Media Library, if a user tries to upload large files (using either basic or advanced upload). The Sitecore media library prompts an error saying that one or more files could not be uploaded. See the Log files for more details.

Solution:

I have seen these kinds of errors pre dominantly in cases where the media uploads are larger in size (more than 30MB)

Below are the areas where you should try to look and make changes accordingly

Check 1: Media.MaxSizeInDatabase setting in web.config

<setting name=”Media.MaxSizeInDatabase” value=”15MB” />

Note: The maximum allowed size of media intended to be stored in a database (binary blob).This value must be less than the ASP.NET httpRuntime.maxRequestLength setting

Check 2: maxRequestLength setting in web.config

 <httpRuntime maxRequestLength=”16384″ executionTimeout=”600″ />

executionTimeout=”[seconds]” – time in seconds before request is automatically timed out

maxRequestLength=”[Kbytes]” – Kbytes size of maximum request length to accept

However there is a catch for users using IIS 7 and higher,

IIS7 has a default configuration that allows only up to 30 MB uploads from being processed.  Oddly, it will return a 404 error if someone uploads something larger than 30MB.

To solve this add the following lines to your web.config <system.webserver> section

<requestFiltering>

             <requestLimits maxAllowedContentLength=”524288000″/>

              maxAllowedContentLength =”[Bytes]” – Bytes size of maximum request length to accept

</requestFiltering>

 


Caution Points:

In general 15MB limit for file uploads should be more than enough for most of the sitecore instances. Increasing the limits and uploading a lot of large files in sitecore can cost dearly on the performance of the site. The immediate affects would be on Publishing time, Database size, (if storing files in database), Moving large media library items from one instance to another can be cumbersome.

Typically if the files are videos, then a separate server to host videos would ideally be the best case or if that doesn’t work then storing these large videos as files would be the alternative which again carries a burden of syncing them across environments. There is a article on storing media library items here which could be helpful in this existing context.

Should you have any questions, Please feel free to comment on this post.