Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/developer-docs/latest/development/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ module.exports = {
delete(file) {
// delete the file in the provider
},
checkFileSize(file, { sizeLimit }) {
// implement your own file size limit logic
// there is a default logic in place if this
// method is not implemented
},
};
},
};
Expand Down
6 changes: 2 additions & 4 deletions docs/developer-docs/latest/plugins/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default [

</code-group>

In addition to the middleware configuration, you can pass the `sizeLimit`, which is an integer in bytes, in the `providerOptions` of the [plugin configuration](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) in `./config/plugins.js`:
In addition to the middleware configuration, you can pass the `sizeLimit`, which is an integer in bytes, in the [plugin configuration](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) in `./config/plugins.js`:

<code-group>

Expand All @@ -148,9 +148,7 @@ module.exports = {
// ...
upload: {
config: {
providerOptions: {
sizeLimit: 250 * 1024 * 1024 // 256mb in bytes
}
sizeLimit: 250 * 1024 * 1024 // 256mb in bytes
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/update-migration-guid

# v4.5.1+ to v4.6.1 migration guide

The Strapi v4.5.1+ to v4.6.1 migration guide upgrades v4.5.1+ to v4.6.1. We introduced a configuration for webhooks to receive populated relations. The migration guide consists of:
The Strapi v4.5.1+ to v4.6.1 migration guide upgrades v4.5.1+ to v4.6.1. We introduced a configuration for webhooks to receive populated relations. Also, this migration guide is needed for all users who were limiting media size for the local upload provider.

The migration guide consists of:

- Upgrading the application dependencies
- Changing the webhooks configuration (optional)
- Updating the local upload provider `sizeLimit`
- Reinitializing the application

## Upgrading the application dependencies to 4.6.1
Expand Down Expand Up @@ -66,4 +69,64 @@ With this, you will no longer receive populated relations in webhooks, and **res

You can see more of the available configuration options in the [server configuration documentation](/developer-docs/latest/setup-deployment-guides/configurations/required/server.md).

## Updating the sizeLimit provider configuration

This step is only required if you were using the [`sizeLimit` configuration](/developer-docs/latest/plugins/upload.md#max-file-size) for your upload provider.

:::caution
The documentation required the `sizeLimit` to be in bytes, but it was actually in kilobytes. This is now fixed, and the limit will be interpreted as bytes.

If you, for some reason, were limiting the file size to kilobytes, you should update the value to be in bytes.
:::

We recommend to move the `sizeLimit` outside the provider options like the following, as it will be deprecated in the next major version.
<code-group>

<code-block title="JAVASCRIPT">

```js
// path: ./config/plugins.js

module.exports = {
// ...
upload: {
config: {
sizeLimit: 250 * 1024 * 1024 // Now
providerOptions: {
sizeLimit: 250 * 1024 * 1024 // Before
}
}
}
};
```

</code-block>

<code-block title="TYPESCRIPT">

```js
// path: ./config/plugins.ts

export default {
// ...
upload: {
config: {
sizeLimit: 250 * 1024 * 1024 // Now
providerOptions: {
sizeLimit: 250 * 1024 * 1024 // Before
}
}
}
};
```

</code-block>

</code-group>

To change the script:

1. In the `./config/plugins.js` file, identify the upload configuration if you have one.
2. (_optional_) If you have a `sizeLimit`, move it one level above `providerOptions`.

!!!include(developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md)!!!