How can I increase file upload limit?

Hi @Dhairya_Kapadia and welcome to the community :slight_smile:

There are currently 3 locations that govern the file upload limit, at the moment they’re quite severely disjointed from each other but there is already awareness of the issue, this will improve in future but it’s been a lot of work for the maintainers to develop all the MFE’s so not everything is quite 100% yet.

One setting lives in the edx-platform repo, this is the original setting that historically controlled the value - Tutor does have an implementation of this setting which can be patched with a openedx-cms-common-settings patch.

There’s also a hardcoded value in the frontend-app-authoring MFE which has to be manually modified in a fork of the repo.

Lastly there’s a Caddyfile setting to allow the maximum file size through the Caddy proxy.

As an illustrative example you might change the setting like this:

  1. Create a fork of the Authoring MFE, edit the value in constants.js and add it to your installation with a plugin like this:
from tutormfe.hooks import MFE_APPS

@MFE_APPS.add()
def _override_authoring_mfe(mfes):
    mfes["authoring"] = {
        "repository": "https://github.com/YourUsername/frontend-app-authoring.git",
        "version": "YourBranchName", 
        "port": 2001, 
    }
    return mfes
  1. Patch the Caddyfile and CMS settings something like this (replace 1024 for the value in MB that you want, but that should give you some leeway for your 800MB file and a little more)
from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-cms-production-settings",
        "MAX_ASSET_UPLOAD_FILE_SIZE_IN_MB = 1024"
    )
)

hooks.Filters.ENV_PATCHES.add_item(
    (
        "caddyfile-cms",
        """
# Maximum asset upload size in CMS/Studio
handle /assets/* {
    request_body {
        max_size 1024MB
    }
}
        """
    )
)
  1. enable the plugins above and rebuild your MFE with tutor images build mfe and then stop/start your instance with tutor local stop && tutor local start -d

If all went according to plan then you should be able to upload larger files now, hope this helps :slight_smile:

2 Likes