Hello all,
Please ehlp if you can!
I have a form in which the user submits a ton of variables to the MySQL database...from the same form the user can upload an image from their desktop.
The form gets submitted to a PHP page which parses all the data:
I do a SQL INSET to insert all the data...it's works fine. Then I call an $ID function which grabs the number the netry was just assigned...
$ID = mysql_insert_id();
Now, I want to name the image that was uploaded in the form the $ID value .jpg, and then stick it in the proper place on my server...(this is the code that doesn't work for me.)
$file_name = "$ID.jpg";
move_uploaded_file ($file, "/home/lightso/movies/images/$file_name");
mysql_close();
?>
Then I take the file that was uploaded and create a thumbnail image of the file...
<?
$iname="$file";
$x=60;
$y=87;
$srcimage = ImageCreateFromJPEG ($iname);
$newimage = imagecreate ($x, $y);
imagecopyresized ($newimage, $srcimage, 0, 0, 0, 0, $x, $y, imagesx($srcimage), imagesy($srcimage));
imagejpeg($newimage,"/home/lightso/public_html/movies/images/thumbs/$ID.jpg");
?>
Everything works except the first image uploading/renaming scheme. Any ideas what I'm doing wrong?
NOTE: This may or may not be a problem, and if it is a problem I need to firgure out a work around...
All images being uploaded through the form are JPG images, BUT these images have names like BBDBDB.01
with no extension! Just so you know!
Thanks in advance!