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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FTP Script Resume a file

    Code:
    $FTPip=123.123.123.123;
    $FTPport=123;
    $LOGfile=123.log;
    $LOGsize=filesize($LOGfile);
    
    $FTPid = ftp_connect($FTPip,$FTPport,5);
    if ($FTPid) {
            echo "connected..<br>";
            if (ftp_login($FTPid,$FTPuser,$FTPpass)) {
                    echo "logged in..";
                    if (ftp_get($FTPid,$LOGfile,$LOGfile,FTP_BINARY,$LOGsize)) {
                            echo "Successfully updated $LOGfile..";
                    }
            }
    }
    ftp_close($FTPid);
    I tried using fopen($LOGfile,'a') but it didn't work.. it connects, logs in, just doesn't get the file.. help
    Last edited by colabus; 06-03-2004 at 07:12 AM.

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    the last argument to ftp_get is the offset of where in the file to start reading , e.g. if you had previously downloaed the first 50 bytes and the connection was lost , you would resume with an offset of 51 ... , so if your local copy of the logfile is the same size as, or smaller than the remote file, then you will download nothing as you are sending the filesize of the local copy as the offset.

    in other words try ,
    PHP Code:
    <?
    ftp_get
    ($FTPid,$LOGfile,$LOGfile,FTP_BINARY);
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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