Jump to content

Very quick question: ftp_nb_put


jkds

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.