Change the maximum attachment/upload size

:bookmark: This guide explains how to change the maximum attachment upload size for self-hosted Discourse instances.

:person_raising_hand: Required user level: System Admin

The default attachment upload size limit is 10MB

If you are self-hosting Discourse and need to allow uploads larger than 10 MB, follow the steps below.

Changing the upload size

  1. Connect to your server:
  • Use SSH to access your server’s command line interface.
  1. Edit the configuration file:
  • Navigate to the configuration directory and edit the app.yml file:
cd /var/discourse/
nano containers/app.yml
  1. Modify the upload parameters:
  • Look for the section labeled params. Directly below, add your desired upload size with careful attention to formatting:
params:
  ## Which Git revision should this container use? (default: latest)
  version: latest
  ## Maximum upload size (default: 10m)
  upload_size: 20m
  1. Save your changes:
  • Press Ctrl+X to exit, then Y to confirm, and Enter to save the changes.
  1. Rebuild the Discourse instance:
  • Run the following command from the /var/discourse directory:
./launcher rebuild app
  1. Update site settings:
  • Go to /admin/site_settings/category/files in your Discourse dashboard.
  • Adjust the max attachment size kb to 20480 (for 20 MB) or your preferred size.

Last edited by @david 2025-09-29T13:05:48Z

Check documentPerform check on document:
62 Likes

Why is the error message incorrect though? Here is my error message.

While trying to upload a 10mb file. The error message is incorrect.

3 Likes

What kind of file was it? Are you able to upload other files to that site?

Sometimes there are browser issues during the upload process that cause temporary issues. Please try uploading your file again, in a new browser session.

2 Likes

Has this article not been updated for a long time? Why can’t I find “upload_size: 20m”???

2 Likes

The first post was updated 5 days ago

The guide says you need to add that line. So, before adding it, you won’t find it. I added some formatting in the quote below. Does that help you?

9 Likes

does it also affect the max image size kb setting?

1 Like

Yes, it does affect any type of upload.

More specifically, I believe the upload_size app.yml setting is given to nginx as client_max_body_size, which is the same parameter provided in the two site settings descriptions:

Max image size KB The maximum image upload size. This must be configured in nginx (client_max_body_size) / apache or proxy as well. Images larger than this and smaller than client_max_body_size will be resized to fit on upload.
Max attachment size KB The maximum attachment files upload size. This must be configured in nginx (client_max_body_size) / apache or proxy as well.
4 Likes

This setting now allows the inputting of MB directly:

Perhaps the setting needs a rename, and the text above updated?

Unless something has changed, what this change to the yml does is change what the maximum size that Discourse allows is. That is, the max size available in the ux is 10mb. This lets you increase that maximum by changing some stuff in the nginx config files.

What I meant was that you no longer need to input kb in the site setting - not that the functionality had changed.

Although it would be nice if the site setting simply reflected what was in the YML without the need for a separate setting.

1 Like

I think while the user input allows using MB too, the value is always saved in KB.

To me, setting names aren’t information for the user but more of a technical term to identify the setting. They aren’t translatable, so admins using Discourse in a different language won’t necessarily understand them at all. And configuring Discourse should work for them too. So the description needs to be good enough on its own.
Maybe English-speaking users should use that perspective too and ignore the setting name, focusing more on the description. Then you wouldn’t be confused by the name.

1 Like

But you might, say, have a multisite instance and some sites want less than the theoretical maximum. That’s at least part of why there are two settings.

1 Like

How about we improve the description text for that setting, and link to this Topic in it?

I think that would make things better for everyone.

1 Like