Issue
I'm working on Ubuntu and I need to create a folder in Drupal's default->files folder with write permission so that I would be able to add files to that folder later on.
Here is the code I have:
drupal_mkdir('public://' . $new_dir . '/');
$file = file_copy($file, 'public://' . $new_dir . '/' . $file_name);
Solution
drupal_mkdir('public://' . $new_dir , 0777);
if you need it to be recursive set third argument to true.
update:
$oldumask = umask(0);
drupal_mkdir("public://". $new_dir , 0777);
umask($oldumask);
Answered By - bhab Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.