Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: time deletion

  1. #1
    Regular Coder
    Join Date
    Apr 2008
    Location
    New York
    Posts
    142
    Thanks
    1
    Thanked 0 Times in 0 Posts

    time deletion

    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?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Apr 2008
    Location
    New York
    Posts
    142
    Thanks
    1
    Thanked 0 Times in 0 Posts
    how does cron work exactly?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •