I have the following lines of php code which should rename a file which already exists on the server to the id generated in the last query:
$image1Oldname = "images/" . $myfile;
$image1NewName = "images/" . mysql_insert_id() . ".jpg";
rename($image1Oldname, $image1NewName);
For some reason this does not rename the file when the script is run.
Any suggestions?
Any suggestions?
Sure.
You have to learn how to debug your code.
It is not a rocket science though.
ini_set('display_errors',1);
error_reporting(E_ALL);
$image1Oldname = "images/" . $myfile;
$image1NewName = "images/" . mysql_insert_id() . ".jpg";
var_dump($image1Oldname, $image1NewName);
rename($image1Oldname, $image1NewName);
exit;