Results 1 to 4 of 4

Thread: Automatic FTP transfers

  1. #1
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Automatic FTP transfers

    Hey

    I wonder if there are some way (program, script, babyslave) to tell a certain file to be "active" on a certain date?

    Let's say I want to give my visitors a special message or pictures the 24th dec and I know I won't be able to upload it myself that day.

    Are there any alternative that let me upload the file but let it "go active" on a certain date? so I dont have to upload it myself and can have my computer shut down?

    Very greatfull for answers

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Not sure about this, exactly.

    There might be some type of ftp tool where you could schedule updates, but you'd need your computer on for this, and not sure how/what would work.

    <?php
    if ((date(n) < 12 || date(j) < 24) && date(y) < 07) {
    die('No input file specified.')
    }
    ?>

    If you add the above php code to your page (and rename the page .php and have php enabled on your server) then that will work great.
    If it's before the date you said (the if statement checks that, specifcally), it will die (stop execution of the script, including sending any html after that point) and output "No input file specified." which is the default for a non-existant php script. (Unlike a 404, you get that, I think because the php-processor tries to run something, but can't find the php script to run, so gives the error.)
    With that, no one would know there's a page there until it's the 24th.

    Aside from this, I would suggest using php.
    PHP isn't running all the time, but rather just processes pages when a browser requests them.
    As such, you would need to request the page.
    You could choose either to do this based on simply the index page, where it checks if it's the 24th yet EACH time it loads (which would slow things down), or add a special page that you could choose to access on the 24th, from, perhaps, your cell phone.
    Code the page so that, when it's the 24th (or when accessed if it's a page only you would know about, if you'd rather have more control if you happened to want it up before the 24th), you visit the page and the script runs and "enables" your files....
    You would upload them before, but have php do something to enable them, like change the original random names (wjwjeiojqfioajflks.jpg) to the real names, or do something along those lines.
    PHP is serverside and can change files/filenames/etc etc on the server, so that would be a good route to take.

    Might be more options, but not too much if you don't have a computer in front of you when you need it to become active.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Upload it to the server then move it into place with a cron job. No interaction required.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks both of you, I will try it later but cronjob sounds really good

Bookmarks

Posting Permissions

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