How to upload large files in Sitecore


Hi guys, I recently stumbled on an issue of uploading large files in Sitecore. While searching about the same I found many blogs stating the solution of setting the size for Media.MaxSizeInDatabase. In Sitecore 10 the default value is 500MB which I increased to 1024MB.

<setting name="Media.MaxSizeInDatabase" value="1024MB"></setting>

The above solution didn’t work for me. Therefore, I dug deep into it and then found the additional changes(mentioned below) which are a mandate to fix the problem of uploading large files in Sitecore.

The ‘maxRequestLength’ property in ASP.NET is the indicator of maximum file upload size supported. This attribute is meant to forbid any service attacks which might be caused as a result of posting large files. It accepts the value in KBs and the default value of this is 50MB (51200KB). Maximum value of this can go up to 2GB. For my usage I had to save the files in the database instead of saving it in the file system. Hence I did the following change to accept the files max upto 1GB.

Update the value of ‘maxRequestLength‘ attribute to ‘1048576

Like ASP.NET, IIS also has it’s own settings for capping the content length to a max limit. Below are the steps to alter it.

IIS settings:

  • Open IIS manager and select the website.
  • Double-click on “Request Filtering”.
  • Select “Rules”.
  • Click “Edit Feature Settings”.
  • Update “Maximum allowed content length” field to “1073741824” there (this number equals 1GB exactly).
  • Make sure that the “Allow double escaping” option is enabled.
  • Click ‘OK’.

In conclusion, the above two settings along with the basic Media.MaxSizeInDatabase will help you do the job and upload large files to Sitecore.

Happy Coding!