Skip to main content

Local Upload provider

The Media Library feature is powered by a back-end server package called Upload which leverages the use of providers.

Strapi maintains 3 providers for the Media Library. The present page is about the local Upload provider installation and configuration. For other providers, please refer to the list in the Media Library Providers page.

Installation

To install the provider, run the following command in a terminal:

yarn add @strapi/provider-upload-local

Configuration

Providers configuration are defined in the /config/plugins file. If this file does not exist, you must create it. The provider configuration accepts the following entries:

  • provider to define the provider name (i.e., local)
  • providerOptions to define options that are passed down during the construction of the provider.

For the local Upload provider, providerOptions accepts only one parameter: sizeLimit, which must be a number. Be aware that the unit is in bytes, and the default is 1000000. When setting this value high, you should make sure to also configure the body parser middleware maxFileSize so the file can be sent and processed (see Media Library documentation for details).

The following is an example configuration:

/config/plugins.js

module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: 'local',
providerOptions: {
sizeLimit: 100000,
},
},
},
// ...
});

As opposed to the AWS S3 and Cloudinary providers, special configuration of the security middleware is not required on the local Upload provider, since the default configuration allows loading images and media from self.