Jump to content

[SOLVED] rename path problem


Exoon

Recommended Posts

Hello,

 

Im trying to rename a directory when a user types in a new game name but keep getting an error saying directory dosent exist but it does.

 

  
<?php
$olddir = "/home/gamer/domains/247gamer/public_html/images/game/$game_console/$game_name2";
$newdir = "/home/gamer/domains/247gamer/public_html/images/game/$game_console/$updated_game_name1";

rename("$olddir", "$newdir")

 

Im getting the following error:

 

Warning: rename(/home/gamer/domains/247gamer/public_html/images/game/ps3/Oliver223,/home/gamer/domains/247gamer/public_html/images/game/ps3/Oliver2234) [function.rename]: No such file or directory in /home/gamer/domains/247gamer/public_html/admin/edit_game.php on line 82

 

I have chmodded images, game, every console and every game name to test it but still says the directory dosent exist.

 

Am i not using it right or somthing, i made a test putting an image in the same directory as the script and that worked fine.

 

Hope some1 can help.

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/
Share on other sites

I'm not sure if this will work, but maybe try:

$olddir = "../images/game/$game_console/$game_name2";
$newdir = "../images/game/$game_console/$updated_game_name1";

if( is_dir( $olddir ) )
    rename("$olddir", "$newdir");
else
    echo "Folder doesn't exist.";

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.