tags:

views:

596

answers:

2
array(1) {
  [0]=>
  string(8) "outgoing"
}
bool(false)
array(1) {
  [0]=>
  string(8) "outgoing"
}
bool(false)

Is currently being produced by

$connect    = ftp_connect('example.com');
$result     = ftp_login($connect, 'username', 'password');

echo '<pre>';
var_dump(ftp_nlist($connect, ''));
var_dump(ftp_nlist($connect, '/outgoing/'));
var_dump(ftp_nlist($connect, '/2689312/'));
var_dump(ftp_nlist($connect, '/2689312/outgoing/'));

But why isn't it letting me list lower than the top directory? This is really stumping me. I can't even get into a sub folder let alone the full folder scheme I need to open.

Any ideas?

+1  A: 

Most FTP services do not let the FTP client who is connecting go further down than the home directory. So check the home directory of the user that is connecting.

It could also be that you are calling the directory wrong.

If /2689312/ is below your starting directory. Try doing ../2689312/

Ólafur Waage
I don't quite get what you mean. I am able to access and browse it perfectly fine using a desktop FTP client, just need to replicate this using PHP so I can grab what's in the contents of one of the sub directories.
James
So you log in to the same server with the same user and are able to browse to this directory? Ok. Ill update the answer.
Ólafur Waage
I've added the full code that is producing it now. It's weird '/2689312/' and '' produce the same thing. But when I log into the FTP using a client, the default directory is /2689312
James
A: 

To get the list of the CWD, instead of:

var_dump(ftp_nlist($connect, ''));

you need to do:

var_dump(ftp_nlist($connect, '.'));

I believe if you want to deeper from there the directory must be:

./subdirectory

cyberbill
With thatvar_dump(ftp_nlist($connect, './outgoing'));var_dump(ftp_nlist($connect, '/outgoing/'));var_dump(ftp_nlist($connect, '/2689312/'));var_dump(ftp_nlist($connect, './2689312/outgoing/'));I now getbool(false)bool(false)array(1) { [0]=> string(8) "outgoing"}bool(false)
James
I believe you are in the wrong working directory. What are the outputs from: var_dump(ftp_pwd($connect)); var_dump(ftp_rawlist($connect, '.')); var_dump(ftp_rawlist($connect, '/2689312/'));
cyberbill
string(8) "/2689312"array(1) { [0]=> string(63) "drwxrwxrwx 1 owner group 0 May 09 08:16 outgoing"}array(1) { [0]=> string(63) "drwxrwxrwx 1 owner group 0 May 09 08:16 outgoing"}
James