October CMS Disallowed File Types

- 1 answer

I'm trying to upload a .pptx file to the media library in October CMS and I'm getting an error because the filetype is not allowed. I have tried using the following suggestion from Stackoverflow:

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

But I get an error message about FileDefinitions class not existing. I have also tried another suggestion of adding to a fileTypes array in /config/cms.php but that doesn't work either as this way of including files seems to be gone.

The October CMS git repo had a pull request which added a file type to the source code but I feel this is not a great idea as different users have different needs and the system would have to be updated every time someone wants a new file type added! Anyway, does anyone know a good way that works of simply adding a new file type the the allow file types array?

Seems like it should be a simple config setting but for the life of me I can't find any working reference.



I guess you added wrong extension there its pptx not ppxt @David Lundquist


return [

    'fileDefinitions' => [
        'defaultExtensions' => [

    // other config

just add this lines to the config/cms.php config and it should work.

but now make sure that it will now only allow files .pptx if you want to allow more extensions you need to add them here manually.

'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'

this is the default list so just copy this list and add your own extra extension here..

in you case its pptx .. and it will work.

I have checked code base there is no other easy way to extend this. { probably hard way require extra plugins and hooks etc ..}

Do not try that array_merge solution as FileDefinitions code will recursively called to get cms config again it will do array_merge ... (out of the topic but it will not work so do not try that)

so better to use this one and this will not affect on updates.

updated every time someone wants a new file type added!

don't worry for only this purpose they provided config files :)

try it, if its not working please comment.