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

لماذا رسالة الخطأ غير صحيحة؟ هذه هي رسالة الخطأ الخاصة بي.

أثناء محاولة تحميل ملف بحجم 10 ميجابايت. رسالة الخطأ غير صحيحة.

3 إعجابات

ما هو نوع الملف الذي كان؟ هل يمكنك تحميل ملفات أخرى إلى هذا الموقع؟

في بعض الأحيان تكون هناك مشاكل في المتصفح أثناء عملية التحميل تسبب مشاكل مؤقتة. يرجى محاولة تحميل ملفك مرة أخرى، في جلسة متصفح جديدة.

إعجابَين (2)

هل لم يتم تحديث هذه المقالة منذ فترة طويلة؟ لماذا لا يمكنني العثور على “upload_size: 20m”؟؟؟

إعجابَين (2)

تم تحديث المنشور الأول قبل 5 أيام

الدليل يقول أنك بحاجة إلى إضافة هذا السطر. لذلك، قبل إضافته، لن تجده. لقد أضفت بعض التنسيق في الاقتباس أدناه. هل يساعدك ذلك؟

9 إعجابات

هل يؤثر ذلك أيضًا على إعداد الحد الأقصى لحجم الصورة بـ كيلوبايت؟

إعجاب واحد (1)

نعم، يؤثر ذلك على أي نوع من التحميل.

بشكل أكثر تحديدًا، أعتقد أن إعداد upload_size في app.yml يُعطى لـ nginx كـ client_max_body_size، وهو نفس المعامل المقدم في وصف إعدادات الموقعين:

الحد الأقصى لحجم الصورة بالكيلوبايت الحد الأقصى لحجم تحميل الصورة. يجب تكوينه في nginx (client_max_body_size) / apache أو الوكيل أيضًا. سيتم تغيير حجم الصور الأكبر من هذا وأصغر من client_max_body_size لتناسب عند التحميل.
الحد الأقصى لحجم المرفقات بالكيلوبايت الحد الأقصى لحجم تحميل ملفات المرفقات. يجب تكوينه في nginx (client_max_body_size) / apache أو الوكيل أيضًا.
4 إعجابات

يسمح هذا الإعداد الآن بإدخال الميجاباي مباشرة:

image

ربما يحتاج الإعداد إلى إعادة تسمية، وتحديث النص أعلاه؟

ما لم يتغير شيء ما، فإن ما يفعله هذا التغيير في ملف yml هو تغيير الحد الأقصى للحجم الذي تسمح به Discourse. وهذا يعني أن الحد الأقصى المتاح في واجهة المستخدم هو 10 ميغابايت. هذا يسمح لك بزيادة هذا الحد الأقصى عن طريق تغيير بعض الأشياء في ملفات تكوين nginx.

ما كنت أعنيه هو أنك لم تعد بحاجة إلى إدخال “كيلوبايت” في إعدادات الموقع - وليس أن الوظيفة قد تغيرت.

على الرغم من أنه سيكون من الجيد لو عكست إعدادات الموقع ببساطة ما هو موجود في YML دون الحاجة إلى إعداد منفصل.

إعجاب واحد (1)

أعتقد أنه بينما يسمح إدخال المستخدم باستخدام ميجابايت أيضًا، يتم دائمًا حفظ القيمة بالكيلوبايت.

بالنسبة لي، أسماء الإعدادات ليست معلومات للمستخدم ولكنها مصطلح تقني لتحديد الإعداد. إنها غير قابلة للترجمة، لذا فإن المسؤولين الذين يستخدمون Discourse بلغة مختلفة لن يفهموها بالضرورة على الإطلاق. ويجب أن يعمل تكوين Discourse بالنسبة لهم أيضًا. لذا يجب أن يكون الوصف جيدًا بما يكفي بمفرده.
ربما يجب على المستخدمين الناطقين باللغة الإنجليزية استخدام هذا المنظور أيضًا وتجاهل اسم الإعداد، مع التركيز بشكل أكبر على الوصف. عندها لن تربكك التسمية.

إعجاب واحد (1)

ولكن قد يكون لديك، على سبيل المثال، مثيل متعدد المواقع وتريد بعض المواقع أقل من الحد الأقصى النظري. هذا على الأقل جزء من سبب وجود إعدادين.

إعجاب واحد (1)

ما رأيك في تحسين نص الوصف لهذا الإعداد، وربطه بهذا الموضوع فيه؟

أعتقد أن هذا سيجعل الأمور أفضل للجميع.

إعجاب واحد (1)