ftp_get date file name

Discussion in 'PHP' started by sensoryaddict, Sep 1, 2010.

  1. #1
    Hi,

    I need help with some code to download a daily file via ftp.

    The file name is based on date. So for example.

    08312010-file.csv
    09012010-file.csv
    09022010-file.csv
    etc..

    I need the script to download the daily file. Has anybody done this before?
     
    sensoryaddict, Sep 1, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Refer to the PHP documentation for the date function (for the filename) and the readfile function (which will contain an example to download a file).
     
    danx10, Sep 1, 2010 IP
  3. sensoryaddict

    sensoryaddict Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks figured it out, simple enough.

    $date = date("mdY");

    $file = $date . "-file.csv";
     
    sensoryaddict, Sep 1, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    Yep now apply the example located at the readfile function page, to $file and you set to go.
     
    danx10, Sep 1, 2010 IP