---
title: Staging large files
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Kentico allows you to limit the size of files that are synchronized by [staging](https://docs.kentico.com/k82/deploying-websites/content-staging.md). Files that support staging include:

- [Page attachments](https://docs.kentico.com/k82/managing-website-content/working-with-files/page-attachments.md)
- [Files in Media libraries](https://docs.kentico.com/k82/managing-website-content/working-with-files/media-library-files.md)

You can set a size limit to prevent the system from using too many resources by synchronizing files that are too large. You can also increase the limits if you need to stage files that are larger than is allowed by default.

> **Note:** The system only logs staging tasks for files when the changes are performed via the Kentico administration interface. If you make changes directly in the file system, for example upload or update files using FTP, the changes are not logged.
>
> If you make a change to a file via the administration interface and then update the file using FTP, the current file (the one updated using FTP) will be transferred to the target server, even if the staging task was created before the file upload. This happens because the system loads the binary data of the files at the time of synchronization, not when the synchronization task is logged.

## Changing the maximum content and request size

One way to restrict staging of files is to adjust the limits of the maximum request size for the staging service:

1. On the **target**  **server**, edit the **web.config** file in the **CMS** folder of the web project.
2. Add a **** element for the staging service into the __ section and set the following attributes:
   - **maxRequestLength** (__ element under __). The value is in **kiloBytes**.
   - **maxAllowedContentLength** (_// element under&#x20;_). The value is in **Bytes**.

```html

<location path="CMSPages/Staging">
    <system.web>
        <httpRuntime executionTimeout="2400" maxRequestLength="4096" />
    </system.web>
    <system.webServer>
        <security>
            <requestFiltering>
              <requestLimits maxAllowedContentLength="4096648" />
            </requestFiltering>
        </security>
    </system.webServer>
</location>

```

> **Warning:** **Note**: The default web.config already contains a **** and **** tag under a location element that only affects WebDAV configuration. These default tags do NOT affect the request limits for staging or the application in general.

3. Save the web.config file.

Synchronizing files larger than the set value results in failure (the target server returns an _HTTP status 404: Not Found_ error).

> **Note:** **Important**: The binary data of files only forms a part of the synchronization requests. You may need to set a higher maximum value than the file size that you wish to allow.

> **Info:** You can also configure the limits on the **source server** by setting the **maxRequestLength** and **maxAllowedContentLength** attributes inside the main __ and __ sections of the web.config (NOT within a specific __ section).
>
> This affects all types of requests, not just the staging service.

## Limiting maximum media library file size

To limit the maximum size of files staged from [media libraries](https://docs.kentico.com/k82/managing-website-content/working-with-files/media-library-files.md):

1. On the **source** **server**, edit the **web.config** file in the **CMS** folder of the web project.
2. Add the **CMSMediaFileMaxStagingSize** key into the __ section of the web.config. The value is in **kiloBytes**.

   ```html

   <add key="CMSMediaFileMaxStagingSize" value="102400" />

   ```
3. Save the web.config file.

The system does not synchronize media library files above the limit — the synchronization only transfers the database definitions of the media objects without the files. You can find records of files not being synchronized in the [Event log](https://docs.kentico.com/k82/developing-websites/troubleshooting-websites/working-with-the-system-event-log.md).
