Help!! - File rename problem
Posted: Fri Dec 16, 2005 3:44 am
Hi,
I use the script below to rename the uploaded image files. THe script works fine but I would like to use as filename the product_id taken from my recordset.
When I try to use $row_prod['prod_id'] which is the value that returns my id in the $rename variable , i get a renamed file without name but just an extension ( .jpg)
The script:
Any ideas??? 
Burrito: Please use
I use the script below to rename the uploaded image files. THe script works fine but I would like to use as filename the product_id taken from my recordset.
When I try to use $row_prod['prod_id'] which is the value that returns my id in the $rename variable , i get a renamed file without name but just an extension ( .jpg)
The script:
Code: Select all
$rename = "Anything";
$old_name = $_FILES['Image']['name'];
$read_extension = explode(".", $old_name);
$ext = $read_extension[1];
$new_name = $rename.".".$ext;
rename("images/prod/".$old_name, "images/prod/".$new_name);Burrito: Please use
Code: Select all
tags when [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting PHP Code In The Forums[/url][/size]