View Full Version : time deletion

05-12-2008, 04:31 AM
with my slideshow project, is there a way to have a photo deleted after a certain amount of time?

my project is to have an image rotation slideshow. once a user uploads a photo, is there a way to set a time limit for the photo to be on the slideshow and deleted from the photos folder and the database table? how can i do this?

05-12-2008, 06:06 AM
Store a timestamp of when the photo was uploaded. Then run a cron job that checks to see if the photo has been there longer than a certain time. If it is then delete the photo from the database and use unlink to delete the photo from the server.

05-12-2008, 06:36 AM
how does cron work exactly?

05-12-2008, 07:00 AM
On linux servers its a command that tells a script to run at a certain time. Most webhosts now days that run on linux servers have simple to use interfaces to setup cron jobs. Check in your control panel.