PHP/MySQL

From: Date: Sat, 04 Jan 2003 21:55:45 +0000
Subject: PHP/MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-24554@lists.php.net to get a copy of this message
Hi, I hope someone can help me with this. I am trying to modify this portion of a script so that I can upload photos (MacOSX 10.2.3) but keep the file names intact. At the moment everything works fine except that when I upload photos, the script changes the name of the file I just uploaded to a new filename (sequentially) based on the database 'id' number to 1.gif, 2.gif, 3.gif and so on. I need to be able to keep the filename as it is (05-01.gif, 23-02.gif etc) when I upload it! // // Insert the photo details into the database // $result = mysql_query("INSERT INTO photo (id,galleryid,title,size_in_MB,person,filename,description) VALUES ('','$galleryid','$title','$size_in_MB','$person','$filename', '$description') "); // // Retrieve the ID of the photo // $result = mysql_query("SELECT * FROM photo WHERE galleryid = '$galleryid' AND title = '$title' AND description = '$description'"); $id = mysql_result($result,0,"id"); // // Generate a filename for the file // $filename = "$id.$format"; // // Alter the database record to point to the correct // filename. // $result = mysql_query("UPDATE photo SET filename = '$filename' WHERE id = '$id'"); // // Move the thumbnail and full-sized photo to the correct filesystem // location. // copy ($photo,"$filepath/$galleryid/photos/$id.$format"); copy ($thumbnail,"$filepath/$galleryid/thumbnails/$id.$format"); // // Print out a Success message to the user. // Regards Mike -- -------------------------------------------------------------- Mike C Macintosh Support Specialist University of Otago (ITS) Dunedin NEW ZEALAND http://www.otago.ac.nz --------------------------------------------------------------

« previous php.db (#24554) next »