PHP Forums Archive

php/ajax upload -deleting uploaded file

Tags: upload, ajax, delete

bmorvai posted on 2009-02-13 23:48:36 #

Hi!

Using the well functioning php/ajax upload the uploaded images stuck on server. Is there a convenient ajax (non-refreshing) way to let the user delete his uploaded images?
I also use sql to place new file names in the adequate row to identify files for further use. Every time I upload a new image the database is updated, but the replaced picture stays on the server. How could I delete it automatically during the update/replace process?

Thanks in advance,
Bálint

Comments / discussions

Olaf posted on 2009-02-14 07:44:41 #

Hi,

I get you right that you place the upload function together with an existing record?

If you need to delete on old picture during update, you can delete the file inside the upload script:
Pass the record ID to the upload (php) script, query the database and delete the old file with the upload class (there is also a delete method)