Restrict selectable file-type in asset field


#1

Hello!

quick question: is it possible to restrict the file-type which can be selected by the user in an asset field? Like: only jpg and png. Or only pdf…

Thanks!


#2

You can’t restrict, which files are selectable, but you can restrict the upload via config.yaml.

# define allowed file types for uploads (global)
assets.allowed_uploads: png, jpg, jpeg

# define allowed file types for uploads (for user groups)
groups:
    author:
        $admin: false
        $vars:
            assets.allowed_uploads: png, jpg, jpeg