Jump to content

rename warning error


ss2003

Recommended Posts

When I try to use rename I get an error:

Warning: rename(./x.JPG;,./v.jpg;): No such file or directory in /home/content/html/test/index.php on line 27

Am I using it correctly? Here is a snip from my code:

24 $ext = findexts ($old_name) ;
25 $new_name = str_replace(" ", "-", $new_name);
26 $new_name = $new_name . '.' . $ext;
27 rename ("./".$old_name, "./".$new_name);

Is there some way to specify the current directory? Some syntax error?

Thanks!
Link to comment
https://forums.phpfreaks.com/topic/27229-rename-warning-error/
Share on other sites


To specify the current directory, just dont use any directory descriptors, like ./  You might also want to check the filenames as they have to be exact.

It also appears that the filenames x.JPG and v.jpg have semicolons at the end, such that they read "x.JPG;" and "v.jpg;"
are you sure your funcfion findexts() is working right?
Link to comment
https://forums.phpfreaks.com/topic/27229-rename-warning-error/#findComment-124505
Share on other sites

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.