Storing temporary images - is there a best practice approach? |
[eluser]rvillalon[/eluser]
I have an "add product" section on my site in which I use flash+jquery to upload images relating to products. It saves images to my website before creating the product. So, sometimes, if I upload images and don't go through creating the product, it just sits in my server. I'm trying to improve my system so I was wondering what would be a good way to temporary save the images? In a nutshell, once a product is added, temporary images get linked to their respective product. I figure I have two options: Option 1 - Sepeaated - Have a temporary upload directory (/temp_images) - Have a saved upload directory (/saved_images) - once the user saves the product, the images get moved here - Have an images_temp table to track the temporary images (file name, who it belongs to, upload datetime) - Have an images_saved table to storehouse the saved images Option 2 - Not separated - Store all images (temporary or not) in one folder - Have one image table to track the images Everyday, I would run a script to clean up any temporary images laying around. Which option is better? And why? If you have database design tips too, that would help! Any comments are greatly appreciated!
[eluser]bretticus[/eluser]
I think the easiest option is Option 3 - Have a temporary upload directory (/temp_images) - Have a saved upload directory (/saved_images) - once the user saves the product, the images get moved here - Have a cron job and use a variation of the find command to delete images older than x number of days in the temp folder. |
Welcome Guest, Not a member yet? Register Sign In |