Forum Moderators: coopster

Message Too Old, No Replies

How to edit folder name?

         

phprockz

1:24 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



Hi,
I want to moidfy my folder name from admin panel using php.How can i do like that.

Psychopsia

1:34 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



You can rename the folder name with the function:

rename($old_name, $new_name)

[php.net...]

You should check this function too, for file/directory permission:

chmod($filename, $mode)

[php.net...]

Hope this helps :)

phprockz

4:31 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



HI,

I followed manual and i am able to rename in localhost .But when i tested in server with following code iam getting errors

<?php
$oldfolder=$row_rsmain['folder'];
$newfolder=$_GET['folder'];
chmod("/home/#*$!xx/public_html/$oldfolder", 0777);
rename("/home/#*$!xx/public_html/$oldfolder", "/home/#*$!xx/public_html/$newfolder");
?>

Iam getting error like this

Warning: chmod() [function.chmod]: Operation not permitted in /home/indiantu/public_html/#*$!#*$!/index.php on line 449

Permission denied in #*$!

Psychopsia

5:36 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



If your calling script is in root /, try removing the full path to the directory:

chmod($oldfolder, 0777); 
rename($oldfolder, $newfolder);

phprockz

2:48 am on Sep 14, 2006 (gmt 0)

10+ Year Member



Thanks i got solution.I did using ftp_rename. If any one need solution reply to this post i will post code :)