Skip to main content

How can I adjust file upload limits and ensure they apply in both local and live environments in Umbraco CMS?

Keywords: CMS, upload limit

Written by Joana Knobbe
Updated over 2 weeks ago

Adjusting File Upload Limits in Umbraco CMS

Managing file uploads in Umbraco CMS often requires adjusting default settings to accommodate larger files. This article provides guidance on increasing file upload limits and ensuring these changes are applied consistently across local and live environments.

Adjusting File Upload Limits

To enable the upload of larger files:

  1. Modify the Maximum Allowed File Size:
    - Update the configuration settings to increase the maximum allowed file size. This is typically done by adjusting the maxAllowedContentLength parameter in your configuration file.
    - Ensure the new limit accommodates the size of the files you intend to upload.
    ​
    You can set the limit in the web.config with the following:

    <?xml version="1.0"?>
    <configuration>
    <system.webServer>
    <security>
    <requestFiltering>
    <!-- 2 MB in bytes -->
    <requestLimits maxAllowedContentLength="2000000" />
    </requestFiltering>
    </security>
    </system.webServer>
    </configuration>

  2. Consider Bandwidth Usage:
    - Serving larger files can impact your site's bandwidth usage, as visitors will download these files directly from your site. Plan your hosting resources accordingly.

Applying Configuration Changes in Local and Live Environments

Changes made to upload limits in a local environment do not automatically apply to live environments, especially when using Umbraco Cloud. To ensure consistency:

  1. Use Environment-Specific Config Transforms: - Create a configuration transform file for the specific environment (e.g., Live) where the changes need to be applied. - In the transform file, set the requestFiltering > requestLimits > maxAllowedContentLength parameter to the desired value.

  2. Deploy Changes to the Live Environment: - Commit the configuration transform file to your source control. - Deploy the changes to the live environment to ensure the new upload limits are applied.

Best Practices for Managing Large Files

  • Optimize File Sizes: Compress files where possible to reduce their size without compromising quality.

  • Monitor Bandwidth Usage: Regularly review your site's bandwidth usage to ensure it aligns with your hosting plan.

  • Test Configurations: After making changes, test file uploads in both local and live environments to confirm the new limits are working as expected.

By following these steps, you can effectively manage file upload limits in Umbraco CMS and ensure a seamless experience for both administrators and site visitors.

Did this answer your question?