Permission denied error when using rename()
Posted: Wed Mar 25, 2009 4:08 pm
HI
I'm trying to rename a load of directorys in one of my folders
I get the following error : Permission denied on line 13. I checked the permissions under the properties folder and made everyobdy have read and write access but this did not work. Of course I don't want any user other than myself to be able to modify my files/folders but they must be able to view the pictures which are placed in these folders.
I'm trying to rename a load of directorys in one of my folders
Code: Select all
<?php
$dir = '/opt/lampp/htdocs/websites/pix';
$files1 = scandir($dir);
?>
<?php
$dir = '/opt/lampp/htdocs/websites/pix';
$files1 = scandir($dir);
foreach ($files1 as $fileobject){
$newfileobject = str_replace(" ", "_" ,strtolower($fileobject));
$newfile = $dir . "/" . $newfileobject;
$oldfile = $dir . "/" . $fileobject;
if (is_dir($oldfile) && ($fileobject != "." && $fileobject != "..")){
rename($oldfile,$newfile);
echo "$fileobject : Changed to $newfile<br>";
}
}
?>