Skip to content

Set up upload restriction on file type

Simon Georget edited this page May 5, 2015 · 6 revisions

There is 2 ways to restrict upload regarding file extension with a logic similar to Apache access control.

By default, allowed extensions are listed as an array into uploadRestrictions variable.

In scripts/filemanager.config.js find the Security policy section and edit config variables :

    //Security policy : take value "ALLOW_ALL" / "DISALLOW_ALL"
    var uploadPolicy = "DISALLOW_ALL";
    var uploadRestrictions = ['jpg', 'jpeg', 'gif', 'png', 'txt', 'pdf', 'odp', 'ods', 'odt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'ogv', 'mp4', 'webm', 'ogg', 'mp3', 'wav'];
  1. Setting uploadPolicy with DISALLOW_ALL value means, by default the filemanager won't accept any uploads except for files having extensions mentioned into uploadRestrictions array.
  2. Setting uploadPolicy with ALLOW_ALL value means, by default the filemanager will accept any type of files for upload except for files having extensions mentioned into uploadRestrictions array.