Report this

What is the reason for this report?

How to change the max filesize in media library

Posted on June 10, 2020

I installed the strapi server on digital ocean and it works nice. But the standard configuration of the media library filesize is set to 1 MB, which is too less.

How can i configure this to - let’s say - 5MB per file (image)



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0

The answer is not in the strapi configuration, but in the nginx.conf file.

By default, Nginx has a limit of 1MB on file uploads. To set file upload size, you can use the client_max_body_size directive, which is part of Nginx’s ngx_http_core_module module. This directive can be set in the http, server or location context.

It sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. Here’s an example of increasing the limit to 100MB in /etc/nginx/nginx.conf file.

http { … client_max_body_size 100M; }

Hello, @bstuijts

You can double check the maxFileSize in the config/environments/development/request.json file

"parser": {
    "enabled": true,
    "multipart": true,
    "formidable": {
      "maxFileSize": 52428800
    }
  }

You can adjust the value according to your needs. You can further check the strapi documentation using the following link:

https://strapi.io/documentation/3.0.0-beta.x/plugins/upload.html

Hope this helps!

Regards, Alex

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.