I'm building an blog system, which allow user add image to their blog.
when user add image, the image will be upload automatically, this happened before the blog is posted, so how should I handle the uploaded image, these image is kind of like temporary image, because if the user post the blog, these images will have an foreign key to this blog , and saved into some folder,but if the user discard the blog , these temporary images should be deleted.
the problem is how to get the firstly uploaded images,when the blog is actually posted? where should I store these temporary images? and how can I tell if the user discard the blog?
I would suggest the following:
Hope it helps.