2008年12月31日星期三

[fw-core] Image upload and database insert, correct way

Hi,
 
Wishing everyone a very happy, prosperous and fun-filled 2009.
--
 
I have an image upload form, where on successful upload...
1. I copy the image from the temp location, to its final location (after renaming)
2. Delete the original image from the temp folder
3. Insert the image information into the database
 
All works fine, but what i'd like to know is, if I am doing the steps in the right order (1,2,3).
One drawback of the above order is that I do not have the insert id while renaming the image (which i'd really like to have). But at the same time I am not sure if db insert should be done first and the image renamed/cleaned later.
 
All guidance is appreciated.
 
-R
 
P.S. I am on shared host, where there are (not very often, but they do happen) db issues :)

没有评论: