[RESOLVED] Problem in renaming directories
Hello
How can I rename directories?
I wrote this code:
<?php
rename ("old","new");
?>
And I set the folder permission to "777".
When I open the page, the error shows:
Warning: rename(old,new): Permission denied in /home/onh1/domains/onh1986.com/public_html/eenglish/a.php
Note: I use PHP version 4.4.
What's problem, please?
Thanks & Regards
Re: Problem in renaming directories
When you rename a directory, you are not modifing the directory itsself, rather, you are modifying the directory listing of the parent directory. Therefroe, you need to have the appropriate permissions on the parent directory of the directory your want to rename.
Renaming is exaclty the same as moving a file or directory. This is actually what PHP does when you call rename.
Re: Problem in renaming directories
What's the code exactly to rename a directory?
Re: Problem in renaming directories
Read my reply. Somewhere, in that you'll find your answer.
Re: Problem in renaming directories
I did't understand.
Can u explain me more on how to rename a directory, please?
I set permission to "read/write", but I couldn't rename it.
Re: Problem in renaming directories
You need to set the permissions on the parent directory. Not the directory you are moving. You don't need to modify any code.
Re: Problem in renaming directories
It's working.
Thanks very very much.