I want to have an asset field which only allows
To be more specific, I want to upload icons I can later import in my templates via the
svg() command. Is this possible without any plugins or a custom field?
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.Sign up to join this community
You can achieve this using the
extraFileKinds config setting like this:
'extraFileKinds' => [ 'svg' => [ 'label' => 'SVG', 'extensions' => ['svg'], ], ],
On your Asset field, check the "Restrict allowed file types?" checkbox, and select "SVG" from the list.