Answer the question
In order to leave comments, you need to log in
How can I change the permissions of a folder and its attachment using php?
I have a temp folder with files. I need to change the permissions of the contents of the temp folder. It's important to know that the content of the temp folder is an unpacked zip and I don't know exactly what files are in there.
Answer the question
In order to leave comments, you need to log in
exec ("find /path/to/folder -type f -exec chmod 0777 {} +"); - папки
exec ("find /path/to/folder -type d -exec chmod 0777 {} +"); - файлы
Recursively change permissions on all files in a directory:
php.net/manual/en/function.chmod.php#87826
<?php
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pathname));
foreach($iterator as $item) {
chmod($item, $filemode);
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question