You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/cms/features/media-library.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,7 @@ When using the default upload provider, the following specific configuration opt
111
111
|`providerOptions.localServer`| Options that will be passed to <ExternalLinkto="https://github.com/koajs/static"text="koa-static"/> upon which the Upload server is build (see [local server configuration](#local-server)) | Object | - |
112
112
|`sizeLimit`| Maximum file size in bytes (see [max file size](#max-file-size)) | Integer |`209715200`<br/><br/>(200 MB in bytes, i.e., 200 x 1024 x 1024 bytes) |
113
113
|`breakpoints`| Allows to override the breakpoints sizes at which responsive images are generated when the "Responsive friendly upload" option is set to `true` (see [responsive images](#responsive-images)) | Object |`{ large: 1000, medium: 750, small: 500 }`|
114
+
|`security`| Configures validation rules for uploaded files to enhance media security | Object | - |
114
115
115
116
:::note
116
117
The Upload request timeout is defined in the server options, not in the Upload plugin options, as it's not specific to the Upload plugin but is applied to the whole Strapi server instance (see [upload request timeout](#upload-request-timeout)).
Configures validation rules for uploaded files to enhance media security.
335
+
336
+
:::note
337
+
It's best to define either `allowedTypes` or `deniedTypes`, not both, to avoid conflicts in file validation logic.
338
+
:::
339
+
340
+
You can provide them by creating or editing [the `/config/plugins` file](/cms/configurations/plugins). The following example sets the `allowedTypes` filter:
341
+
342
+
<TabsgroupId="js-ts">
343
+
344
+
<TabItemvalue="javascript"label="JavaScript">
345
+
346
+
```js title="/config/plugins.js"
347
+
module.exports= {
348
+
// ...
349
+
upload: {
350
+
config: {
351
+
security: {
352
+
allowedTypes: ['image/*', 'application/pdf']
353
+
},
354
+
}
355
+
}
356
+
};
357
+
```
358
+
359
+
</TabItem>
360
+
361
+
<TabItemvalue="typescript"label="TypeScript">
362
+
363
+
```js title="/config/plugins.ts"
364
+
exportdefault {
365
+
// ...
366
+
upload: {
367
+
config: {
368
+
security: {
369
+
allowedTypes: ['image/*', 'application/pdf']
370
+
},
371
+
}
372
+
}
373
+
};
374
+
```
375
+
376
+
</TabItem>
377
+
378
+
</Tabs>
379
+
322
380
#### Upload request timeout
323
381
324
382
By default, the value of `strapi.server.httpServer.requestTimeout` is set to 330 seconds. This includes uploads.
0 commit comments