Skip to content

Set up upload restriction on file type

simogeo edited this page Feb 7, 2013 · 6 revisions

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

By default the following extensions are allowed for upload into Filemanager :

jpg, jpeg, gif, png, txt, pdf, odp, ods, odt, rtf, doc, docx, xls, xlsx, ppt, pptx, ogv, mp4, webm.

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'];
  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.