My problem: how to get the filename of the newly created file on the server.
Explanation: I've got a small bit of code that converts an uploaded image from TIF to JPG, and copies it to the server. I'll post that below. My problem: getting the NEW imagename to come back, NOT the one that was originally uploaded (ie. I want mytest.jpg to come back, not mytest.tif, the original filename). When I look at the server, mytest.jpg is there and mytest.tif has been eliminated (just like I want). When I echo my SQL statement, I get this result back:
UPDATE content SET info='mytest.tif', location='main1', active='0', alt='WOW - the lowest all-digital price in America! $22.99/mo.' WHERE location='main1'
Code that copies and converts image:
//change format of image to jpeg and resize to specs
system("mogrify -format jpg -sample '$new_w>' '$dir$directory$userfile_name'");
copy($userfile,$graphic);
//get rid of the TIF file
unlink($dir.$directory.$userfile_name);
Code that updates the database:
# Create the Query.
$sql = "UPDATE content
SET info='$userfile_name', location='main1', active='0',
alt='$row[alt]'
WHERE location='main1'";
# Make the Query
#$ok = mysql_query ($sql);
echo $sql;