What is the maximum file size we can upload on discourse?

Hi all,

Curious to know what is the maximum allowed file size that can be uploaded on the platform?

Currently, we have it at 184 MB. However, when I try to upload a file of 40-50 MB it fails to upload.

Thanks in advance.
Kanishk

You probably need to change your nginx config too

3 Likes

Sorry for bumping this topic. I tried everything to change max upload size but my instance allows only 1 (one) mb to attach. I played with 10, 20mb and defaults.

I got client_max_body_size 100m;:

1. using custom command `sed -i 's/client_max_body_size 10m;/client_max_body_size 100m;/g' /etc/nginx/conf.d/discourse.conf`
2. using param `upload_size: 100m` in app.yml
3. by hands inside the container

1 and 2 - I rebuilt app, 3 - reload nginx inside container.

This is a fresh installation, only official plugins. Custom things are: Office 365 login and self-signed certificate (because the server is located inside intranet, and Office 365 login requires https). Everything works: login, emailing, answering by email. But attachment size is about 1 mb max (both files and pictures). I allow * for filetypes. I have external proxy Nginx with the same setting om 100mb body size.

I really confused. I’ve been using Discourse for 4 years. Do I have incorrect settings or conflicts? Could somebody navigate me what to check first please?

Hi @merefield,

@Ivan_Rapekas is right. It just doesn’t work. Some backend restriction that just doesn’t allow us to increase upload size of a file.

Have you read through this?

2 Likes

Yup that’s a better solution as imagine nginx config gets rebuilt every time which might be why the configuration is not persisted if you amend it directly :+1:

Initially (inside container):

Update app.yml to :

image

Post rebuild:

So perhaps that was your problem @Kanishk_Jaswal , it was being reset each rebuild?

1 Like

Sure. I researched all relevant topics. The strange thing is 1mb size. It would enough 10mb for me, but I can’t reach this.

Thanks for this point, I checked it - seems settings are ok…

1 Like

indeed, and you said earlier “about” 1mb, even weirder.

Any possibility of an unusual firewall/router/network/vpn setting ? Does the app give you an error, or does the upload fail silently?

1 Like

Thank you for the support. I realized that external proxy might have incorrect body size setting. Just checked the log…

Seems that’s my fault. Hope I’ll fix it soon and return the correct setting for external Nginx.

2 Likes

Thanks to all.

So, I have Nginx in front of Discourse. It has configs:

/etc/nginx/nginx.conf (default)
/etc/nginx/conf.d/discourse.conf (custom)

Both configs have server{} sections. First I put client_max_body_size 100m; in custom config. Actually the setting did not work, but I did not check proxy logs.

When I moved client_max_body_size 100m; to default config (parent config), the problem resolved.

So, Changing Max Attachment Size article is actual. The root cause was in external proxy setting, outside of Discourse which is the best :slight_smile: .

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.