the function unlink() will delete your old file...
http://www.php.net/manual/en/function.unlink.php

----- Original Message -----
From: "Brad R. C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to