1

When creating directory using function drupal_mkdir in custom module, how to set folder permission access to "Create and delete files"?

drupal_mkdir('public://myfolder/');
2

The second parameter is $mode, which you can provide. e.g.

drupal_mkdir('public://myfolder/', 0755);

By default the 'file_chmod_directory; will be used, which, by default, is 0775.

Exactly what mode you use will obviously depend on your server set up. If you're not sure, ask your sysadmin what it should be.

  • I have an error: "Warning: mkdir(): Permission denied in DrupalLocalStreamWrapper->mkdir() (line 639 of /var/www/videogallery/includes/stream_wrappers.inc)." – josaric Oct 21 '14 at 9:43
  • You need to change the permissions on the parent folders, so your web server user can write to the files folder. You'll need to do this on the server itself, Drupal can't do it. – Clive Oct 21 '14 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.