0

whenever i try to upload a .docx file via October Cms media manager and I get this " The file type used is blocked for security reasons " how can I overwrite the allowed file extensions ?

I'm using BUILD 415

Asma.Said
  • 3
  • 3

3 Answers3

0

octobercms allow only some extensions in file manager. You need to add specific one by hand.

add docx extension at CMS config. in config/cms.php, add:

'fileDefinitions' => [
    'assetExtensions' => array_merge(FileDefinitions::get('assetExtensions'), ['docx']), ],

you can find the list of supported extensions here : https://github.com/octobercms/library/blob/master/src/Filesystem/Definitions.php

0

I only got this to work by adding the full override explicitly to config/cms.php. In my case

'fileDefinitions' => [ 'assetExtensions' => [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg', 'js', 'map', 'ico', 'css', 'less', 'scss', 'ics', 'odt', 'doc', 'docx', 'pdf', 'swf', 'txt', 'xml', 'ods', 'xls', 'xlsx', 'eot', 'woff', 'woff2', 'ttf', 'flv', 'wmv', 'mp3', 'ogg', 'wav', 'avi', 'mov', 'mp4', 'mpeg', 'webm', 'mkv', 'rar', 'zip','pptx', 'ppt', 'pdf', 'zip' ] ],

Attempting to append to the array using array_merge gave me an error. It's inelegant to have to override the whole thing, but at least it works. Somewhat amazed that this isn't configurable in the user interface!

Cruachan
  • 15,733
  • 5
  • 59
  • 112
0
'fileDefinitions' => [ 'defaultExtensions' => [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg', 'js', 'map', 'ico', 'css', 'less', 'scss', 'ics', 'odt', 'doc', 'docx', 'pdf', 'swf', 'txt', 'xml', 'ods', 'xls', 'xlsx', 'eot', 'woff', 'woff2', 'ttf', 'flv', 'wmv', 'mp3', 'ogg', 'wav', 'avi', 'mov', 'mp4', 'mpeg', 'webm', 'mkv', 'rar', 'zip','pptx', 'ppt', 'pdf', 'zip' ] ],

Instead of "assetExtensions", use "defaultExtensions".