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.
「いいね!」 62
Can't Increase the Max File Size
What is the max image upload size limit by file type
Image upload size/resize question
Struggling to find correct instructions to increase file upload limit
Upload Large Video
Can't Increase the Max File Size
What is the maximum file size we can upload on discourse?
:cn: Change the max size of uploads/attachments | Discourse 修改上传附件的大小
Image upload error when using resizer
With Uploads -- That page doesn’t exist or is private
Rebuild of Discourse fails due to spaces in YAML file
Category image upload stops at 0%
Issue with maximum upload file size
Attachments max size limit in self and business hosting difference
Do I need to install NGINX and PHP to optimize my Discourse forum?
Remove Dropbox Onebox For Audio Links
Uploads involving client-side JS preprocessing fail in Chrome based browsers
“Image larger than 4mb” error when posting a gif
Inquiry About Discourse’s Support for Amazon S3 Storage
Increasing max file size
NGinx.conf File location
Multipart upload
Can Discourse accept attachments when using emails to create new category topics?
What is the maximum file size we can upload on discourse?
Problem about attachment file size
Max upload size error
Why is my upload limit 100mb?It's set to 500mb
Issue with maximum upload file size
Meta Data From Image Upload
How to change upload limit by command line
Attachments: Oops! That page doesn’t exist or is private
Increase the file size of attachment
Sorry, that file is too big V2
Raising max file upload limit in configs
Allow log file for topic and restricted to admin

エラーメッセージが間違っているのはなぜですか?エラーメッセージはこちらです。

10MBのファイルをアップロードしようとしたところ、エラーメッセージが間違っていました。

「いいね!」 3

それはどのような種類のファイルでしたか?そのサイトに他のファイルをアップロードすることはできますか?

アップロードプロセス中にブラウザの問題が発生し、一時的な問題を引き起こすことがあります。新しいブラウザセッションでファイルを再度アップロードしてみてください。

「いいね!」 2

この記事は長い間更新されていませんか?「upload_size: 20m」が見つからないのはなぜですか?

「いいね!」 2

最初の投稿は5日前に更新されました

ガイドにはその行を追加する必要があると書かれています。そのため、追加する前には見つかりません。下の引用にいくつかのフォーマットを追加しました。これで役立ちますか?

「いいね!」 9

最大画像サイズ(KB)設定にも影響しますか?

「いいね!」 1

はい、あらゆる種類のアップロードに影響します。

具体的には、upload_size app.yml 設定が nginx に client_max_body_size として渡され、これは 2 つのサイト設定の説明で提供されるのと同じパラメータであると考えています。

最大画像サイズ KB 最大画像アップロードサイズ。これは nginx (client_max_body_size)/apache またはプロキシでも設定する必要があります。これより大きく client_max_body_size より小さい画像は、アップロード時にフィットするようにリサイズされます。
最大添付ファイルサイズ KB 最大添付ファイルアップロードサイズ。これは nginx (client_max_body_size)/apache またはプロキシでも設定する必要があります。
「いいね!」 4

この設定により、MB を直接入力できるようになりました。

image

設定の名前を変更し、上記のテキストを更新する必要があるかもしれません。

何かが変更されていない限り、このymlへの変更は、Discourseが許可する最大サイズを変更することになります。つまり、UXで利用可能な最大サイズは10MBです。これにより、nginx設定ファイルでいくつかのものを変更することで、その最大値を増やすことができます。

サイト設定でkbを入力する必要がなくなった、という意味でした。機能が変更されたわけではありません。

サイト設定がYML内の設定をそのまま反映し、別途設定する必要がなくなれば、なお良いのですが。

「いいね!」 1

ユーザー入力ではMBも使用できますが、値は常にKBで保存されると思います。

私にとって、設定名はユーザー向けの情報ではなく、設定を識別するための技術用語です。翻訳可能ではないため、Discourseを異なる言語で使用している管理者には必ずしも理解できません。また、Discourseの設定も彼らにとって機能するはずです。したがって、説明だけで十分である必要があります。
おそらく英語圏のユーザーもその視点を使用し、設定名を無視して、説明に焦点を当てるべきです。そうすれば、名前で混乱することはありません。

「いいね!」 1

しかし、例えばマルチサイトインスタンスがあり、サイトによっては理論上の最大値よりも少なくしたい場合があります。それが、少なくとも2つの設定がある理由の一部です。

「いいね!」 1

その設定の説明文を改善し、そこにこのトピックへのリンクを貼るのはどうでしょうか?

そうすれば、すべての人にとってより良いものになると思います。

「いいね!」 1