Image type restriction in Strapi

59 views Asked by At

On the admin panel, Strapi allows you to upload images of various types. However, I would like to know if there is any way in Strapi v4 to limit images to a specific type (for example, .svg). Is it possible?

I know that it might be possible to do this verification manually in the lifecycles, but it could become too costly to implement this for every collection.

1

There are 1 answers

0
Jim LAURIE On

It's not possible to specify do that in Strapi by default.

I just had a look in the code base of Strapi if it would be easy to customize, and it's not. Plus, using patch-package for that kind of stuff would not be a great recommendation.

I just shared that with the Product team.

I would suggest that you add a description on the Media Field, saying that for that Media Field, YOU SHOULD use a .SVG file. Like that: https://www.loom.com/share/5c0cdd8fe692452b8748cf449c7b156d?sid=27e350fa-1b52-4645-b663-98cb72c80a61

Docs: https://docs.strapi.io/user-docs/content-manager/configuring-view-of-content-type

Have a great day.