jkds Posted April 8, 2010 Share Posted April 8, 2010 Hi all, quick one: Anyone know why ftp_nb_put returns either null, 1 or 2 instead of FTP_FAILED, FTP_FINISHED or FTP_MOREDATA? I'm running the upload like this: $ret = ftp_nb_put($conn_id, $target_file, $source_file, FTP_BINARY); while ($ret == FTP_MOREDATA) { // Continue uploading... echo 'Continuing, returned '.$ret.'<br>'; $ret = ftp_nb_continue($conn_id); } if ($ret != FTP_FINISHED) { echo 'Failed, returned '.$ret; }else{ echo 'Success, returned '.$ret; } ...and I'm getting return values 2 for FTP_MOREDATA, 1 for FTP_FINISHED and null for FTP_FAILED. Any ideas? Link to comment https://forums.phpfreaks.com/topic/197978-very-quick-question-ftp_nb_put/ Share on other sites More sharing options...
oni-kun Posted April 8, 2010 Share Posted April 8, 2010 ftp_nb_put How hard can this be? Link to comment https://forums.phpfreaks.com/topic/197978-very-quick-question-ftp_nb_put/#findComment-1038889 Share on other sites More sharing options...
jkds Posted April 8, 2010 Author Share Posted April 8, 2010 Thanks for the link oni-kun. I have, as you may expect, already referred to the manual page... However, the PHP manual states that the expected return should be FTP_FAILED or FTP_FINISHED or FTP_MOREDATA. I'm getting null, 1 or 2 as return values. That's the problem I was describing. Link to comment https://forums.phpfreaks.com/topic/197978-very-quick-question-ftp_nb_put/#findComment-1038891 Share on other sites More sharing options...
oni-kun Posted April 8, 2010 Share Posted April 8, 2010 Thanks for the link oni-kun. I have, as you may expect, already referred to the manual page... However, the PHP manual states that the expected return should be FTP_FAILED or FTP_FINISHED or FTP_MOREDATA. I'm getting null, 1 or 2 as return values. That's the problem I was describing. If you've read the manual, You'd see they use constants. What happens if you type "print FTP_FINISHED" ? It's a constant. FTP_FINISHED == 1 FTP_MOREDATA == 2 Therefor 1 and 2 are the proper responses. Null is a very common response if the stream cannot be connected (false == 0), and/or if there is an error in the function. Link to comment https://forums.phpfreaks.com/topic/197978-very-quick-question-ftp_nb_put/#findComment-1038897 Share on other sites More sharing options...
jkds Posted April 8, 2010 Author Share Posted April 8, 2010 Thanks again oni-kun, this clears it up! Link to comment https://forums.phpfreaks.com/topic/197978-very-quick-question-ftp_nb_put/#findComment-1038899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.