Jump to content

How should I save images


soccer022483

Recommended Posts

[!--quoteo(post=355214:date=Mar 14 2006, 09:54 PM:name=soccer022483)--][div class=\'quotetop\']QUOTE(soccer022483 @ Mar 14 2006, 09:54 PM) [snapback]355214[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'm creating a classified ads system online. Here's my problem: When someone creates a new ad, they can upload an image. If they upload an image, but end up not creating the ad, I need to delete the image. Do you think this is the best way to do it?
[/quote]

Its ok to have a clean-up process on an aborted transaction.

Another solution is that, because it sounds like an image is optional, only allow image to ads that have been already been created.
Link to comment
Share on other sites

[!--quoteo(post=355273:date=Mar 15 2006, 08:35 AM:name=greycap)--][div class=\'quotetop\']QUOTE(greycap @ Mar 15 2006, 08:35 AM) [snapback]355273[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Its ok to have a clean-up process on an aborted transaction.

Another solution is that, because it sounds like an image is optional, only allow image to ads that have been already been created.
[/quote]

else what you can do is only move the image file from your temporary location to it's permanent directory once the ad has been placed. so do your advert checking first, insert the details into the database, and if all is well, use move_uploaded_files afterwards.
all that needs doing then is an occasional cleanup of your TMP directory.
cheers
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.