[ACCEPTED]-mkdir() in php is setting folder permission to 755 But I Need 777?-mkdir
Accepted answer
Try this:
$old_umask = umask(0);
mkdir($create_path, 0777);
umask($old_umask);
0
This really works for me!, you should close 2 now this question!
- Create the directory!
Give 777 permissions!
$estructure = '../files/folderName'; if(!mkdir($estructure, 0777, true)){ echo "<br/><br/>ERROR: Fail to create the folder...<br/><br/>"; } else echo "<br/><br/>!! Folder Created...<br/><br/>"; chmod($estructure, 0777);
Enjoy 1 it!
Try this:
<?php
// files will create as -rw-------
umask(0);
// create a file, eg fopen()
chmod('/path/to/directory', 0777);
?>
0
The umask of the process is set to 0022. You'll 2 need to set it to 0 if you want to create 1 something with those two write bits set.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.