Jump to content

Archived

This topic is now archived and is closed to further replies.

soccer022483

How should I save images

Recommended Posts

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?

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.