View Full Version : FTP Script Resume a file

06-03-2004, 07:09 AM

$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..";

I tried using fopen($LOGfile,'a') but it didn't work.. it connects, logs in, just doesn't get the file.. help

06-03-2004, 09:22 AM
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 ,