File Rename Not working
Posted: Mon Feb 16, 2009 8:02 am
I'm making a script which renames a image when it is uploaded to use the name of the album it has been uploaded to as a prefix and +1 of what the latest ID is e.g. If the latest ID is 1, it renames the image to 2, at the moment this is not working it is just calling every image 0.jpg. Here is my code.
Thanks in advance for any help 
Code: Select all
$imageNewNamePrefix = $_POST['album'];
$imageNewNameID = mysql_query("SELECT `images`.`photoID` FROM `images` ORDER BY `images`.`photoID` DESC LIMIT 1");
$datarow = mysql_fetch_assoc($imageNewNameID);
$number = $datarow['photoID']+1;
$imageNewNameJoined = $imageNewNamePrefix&$number;
$image_name=$imageNewNameJoined.'.'.$extension;