arbitrageur Posted October 20, 2014 Share Posted October 20, 2014 I'm building a site similiar to a web forum. The code is all done, this is how it works: CREATING POST: ------------------------ In PHP:Create Post -> Upload Images -> Remake Images (For security) -> Create Thumbnails (saved in uploads folder with unique name) With DATABASE: I have a table called "images" which tracks user uploaded images: uploaded_by_username (stores who posted it) image_status (tracking whether user aborted upload) thumbnail_confirm (tracking whether thumbnail generated successfully) post_association (tracking the post that the images go to) image_name (the image filename in uploads filefolder) time (unix time-stamp of upload tracking for admin purposes) DELETING POST: ------------------------ In PHP: Move all images into a "deleted_images" folder ( I'm afraid to use "unlink") With DATABASE: Delete all associated images from images table ( Is this risky? Should I use a second table and transfer the images? ) Anyhow, feedback appreciated in regards to how I designed this. Is this acceptable for the industry? Quote Link to comment https://forums.phpfreaks.com/topic/291939-is-this-a-good-design-image-upload-deletion-in-php/ Share on other sites More sharing options...
requinix Posted October 20, 2014 Share Posted October 20, 2014 1. Depends how you generate the unique name. Should be guaranteed to be unique, not something almost unique like random numbers. 2. I wouldn't bother tracking aborted uploads or whether you were able to generate the thumbnail. If there's a problem then abort the process. 3. Don't delete stuff. Leave the image in the folder and use a column in the table to indicate live/deleted status (you could repurpose "image_status" for that). A more detailed explanation, like the actual code, database schema, and queries, can get you more detailed answers. Quote Link to comment https://forums.phpfreaks.com/topic/291939-is-this-a-good-design-image-upload-deletion-in-php/#findComment-1494224 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.