Re: Image Submission into a Database & Updating

From: Date: Thu, 19 Jul 2001 21:50:07 +0000
Subject: Re: Image Submission into a Database & Updating
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58795@lists.php.net to get a copy of this message
the function unlink() will delete your old file... http://www.php.net/manual/en/function.unlink.php ----- Original Message ----- From: "Brad R. C." <bradc@addictedusers.com> To: <php-general@lists.php.net> Sent: Thursday, July 19, 2001 3:01 PM Subject: [PHP] Image Submission into a Database & Updating > Ok.. I have created a submission form that works great just like what I > want.. > > but there is one minor detail if possible to figure out. When I let users > upload a photo to my site, the image will be stored on the server hdd and > the name of the image will be stored in the database. Works great!.. but > lets say they submit another image in the same form.. it will overwrite the > image name in the database, and uploads the new image.. but what about the > old one? It stays dorment unusable and taking up space on my hdd. So... my > question is.. what line can I add to delete the image before or after > uploading the new one. I mean you can make the old name value into a temp > value, and then it will overwrite the original value and you still have the > temp value.. I think.. here is what by submit code looks like. Hopefully > someone can figure this out. > > -------------code : > if ($submit) { > $connection = mysql_pconnect(SQL_SERVER, SQL_UID, SQL_PWD); > > mysql_select_db(SQL_DB, $connection); > > $sql = "UPDATE user SET > desc_one='".addslashes($desc_one)."',photo_one='".addslashes($picture_name). > "' WHERE userid='userid'"; > > mysql_query($sql); > > exec("cp $picture /root/lets/play/folder/tag/images/$picture_name"); > > return 0; > } > -------------code end. > > Thanks > BradC > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#58795) next »