Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp_raw issue

Status
Not open for further replies.

tweenerz

Programmer
Mar 25, 2002
202
US
hello,

I am using the native ftp functions from php and since the normal ftp_* doesn't give any feedback or responses, I am using the ftp_raw function to do all my commands.

For some reason after I upload or do an nlist, I only get the first line of response back from the control channel:

Code:
150 Opening ASCII mode data connection for '/uploaded.txt'.

Then, when I do another command, I get the next line from the previous command:

Code:
226 Transfer complete.

But that response should have been part of the previous command's response. From that point forward, every response is off by one response. ftp_raw will continually return the response from the previous call, not the one just executed.

For example, here is a sample of the calls and the responses:

Code:
> USER username
       331 Password required for username.

> PASS password
       230 User username logged in, access restrictions apply.

> CWD /ftp_dir1
       250 CWD command successful.

> PASV
       227 Entering Passive Mode (123,45,67,89,111,22)

> STOR /uploaded.txt
       150 Opening ASCII mode data connection for '/uploaded.txt'.

> PWD
       226 Transfer complete.

> NOOP
       257 "/ftp_dir1" is current directory.

> MDTM /uploaded.txt
       200 NOOP command successful.

So you can see, after I issue the STOR command (which is the first command that returns multiple lines) and the file is uploaded (and I have confirmed that it does successfully upload the file), every command after that returns the response from the previous command.

Any help is greatly appreciated.
 
the response from ftp_raw is returned as an array. how are you working with the array?
 
If I do a print_r on the return message from ftp_raw, it always has just one entry in the array. Each one of those responses in the above was in the first and only element of the array.

i.e. print_r($response) returns the following:

Array
(
[0] => 150 Opening ASCII mode data connection for '/uploaded.txt'.
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top