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

alexdo
Site Moderator
Site Moderator badge
June 11, 2020

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel