I'd like to allow certain trusted users to upload files of whichever extension they like.

The nature of what we are using drupal for means that its impossible to list all possible file extensions (some are config files with weird extensions, etc).

Is there a way of doing this?

Comments

DriesK’s picture

I didn't test it, but it should work.

1. Open upload.module.

2. Locate upload_perm() near line 24, and add an extra permission:

function upload_perm() {
  return array('upload files', 'view uploaded files', 'upload any filetype');
}

3. Locate this statement in function upload_nodeapi() near line 176:

// Don't do any checks for uid #1.
if ($user->uid != 1) {

and change it to:

// Don't do any checks for uid #1 or privileged users.
if ($user->uid != 1 || !user_access('upload any filetype')) {

You should now have a functional extra permission in your access control page.