9

I am wondering what would be the best approach to add another file type to the 'Restrict allowed file types' asset field settings?

For our website specification we need to have .zip files and .pdf files only for this field, however I can only restrict to .pdf.

5

Currently, no. The list you see there is the result of a function in IOHelper called getFileKinds. It just hands out an array of options. While I don't have a recommendation for making this work, I do suggest you send a feature request to: support@buildwithcraft.com

With it already being a function, I can see there being a possibility of them allowing users to add custom restricted extension options via a config setting.

8

You can now set allowedFileExtensions and extraAllowedFileExtensions in your config file. The first will re-define the list of allowed files, where the latter will allow you to add additional file types.

For example, I needed to add 3 additional formats:

'extraAllowedFileExtensions' => 'bim, dwg, rvt'

See the documentation here for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.