User Contributed Notes 1 note

Note that you may have to keep calling ftp_nb_continue in order to complete the download. For example, if you do this:

<?phpftp_nb_get($conn,$localfile,$remotefile,FTP_BINARY)//do some LONG time workwhile(ftp_nb_continue($conn)!=FTP_FINISHED){}?>

Your local file may only contains a few kilobytes and the later ftp_nb_continue will keep raising warning of no more data (due to connection time out, I guess).

So you may want to do this instead:

<?php$dl=ftp_nb_get($conn,$localfile,$remotefile,FTP_BINARY)//part of long time workif(ftp_nb_continue($conn)==FTP_MOREDATA) {}//part of long time workif(ftp_nb_continue($conn)==FTP_MOREDATA) {}//continue to do this until you finish the long time workwhile(ftp_nb_continue($conn)==FTP_MOREDATA){}?>