imstillatwork
IS-IT--Management
I have done several web sites that allow the user to upload images, delete the image and overwrite with new images.
I am curious how YOU do the following, because its always better to know more than one way:
Keep in mind: multiple users at the same time could be using this, no ones image should be overwritten be another, ever.
1) Upload Image and Insert filename /info into database. sounds simple, and is, but what about error control do you do? what do you check for?
2) Overwrite Image (erase old, upload new)
check db-get filename, check if file exists and remove. remove filename from db. upload new file, insert new filename.
3) Remove Image.
check db for filename, check file exists, remove image, remove filename from db.
like I said, I've done it several times, but it seems like such a bloated process with multiple queries and everything.
thanks!
I am curious how YOU do the following, because its always better to know more than one way:
Keep in mind: multiple users at the same time could be using this, no ones image should be overwritten be another, ever.
1) Upload Image and Insert filename /info into database. sounds simple, and is, but what about error control do you do? what do you check for?
2) Overwrite Image (erase old, upload new)
check db-get filename, check if file exists and remove. remove filename from db. upload new file, insert new filename.
3) Remove Image.
check db for filename, check file exists, remove image, remove filename from db.
like I said, I've done it several times, but it seems like such a bloated process with multiple queries and everything.
thanks!