12

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.

3 Answers 3

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.

1
13

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.

2

The allowedFileExtensions and extraAllowedFileExtensions config options change what file types are actually allowed to be uploaded at all.

To actually give more options under 'Restrict allowed file types' on an assets field, use the extraFileKinds config option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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