Cms: Allow file kinds to be extended

Created on 30 Mar 2017  路  9Comments  路  Source: craftcms/cms

Description

See this stackoverflow post
I have added extra file extensions to my allowed uploads list in the config file, but the "kind" property is returned as "unknown"

Steps to reproduce

  1. Add extra file types in the config file 'extraAllowedFileExtensions' => 'bim, dwg, rvt'
  2. Loop through the list of uploaded assets on a template and try to access {{ asset.kind }}

Additional info

  • Craft version: 2.6.2958
  • PHP version: 5.6
  • Database driver & version: MySQL
  • Plugins & versions: n/a
assets enhancement

Most helpful comment

3.0.37

All 9 comments

It would be good if this was revealed in the admin as an additional checkbox in the allowed file types list as well.

Something like this would be awesome (I may be using the wrong brackets, but you get the idea):

'extraAllowedFileExtensions' =>
[
   'css': 'Stylesheet',
   'hl3': 'Half-Life 3'
]

Then the "Restrict allowed file types?" section would add checkboxes for any additional type specified there.

One more thought occurs to me regarding this. There should be a way to add more than one extension to a single checkbox. Perhaps:

'extraAllowedFileExtensions' =>
[
   'css': 'Stylesheet',
   'hl3': 'Half-Life 3',
   'hl3-map': 'Half-Life 3', // The "Half-Life 3" checkbox would cover both .hl3 and .hl3-map extensions
   'twig': 'HTML' // would add .twig files to the built-in/native "HTML" checkbox
]

I'm also running into this issue. Need to add .dwg and other technical drawing files to the assets as well.

Any updates on this?

This is an old feature request, @brandonkelly, @angrybrad, but i'd like to put in an emphatic +1 for it.

Added an extraFileKinds config setting for the next release!

@brandonkelly - one question: will this be going into the 3.0.x branch or not until the 3.1 release?

3.0.37

Was this page helpful?
0 / 5 - 0 ratings