Question

How to change the max filesize in media library

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)


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Accepted Answer

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; }

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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