On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote:
I'm trying to create some functionality which requires FTPing onto another
server, using the php functions.

Doing the following comes up with a successful login, but cannot display the
current directory; yet when I FTP directory from the server which is serving
the php pages, it works fine.

// set up basic connection
$conn_id = ftp_connect($ftp_server, 21);
ftp_pasv($conn_id, true);

// login with username and password
$login_result = ftp_login($conn_id, $username, $password);

// check connection
if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $username<br />";
exit;

} else {

echo "Connected to $ftp_server, for user $username<br />";

}

echo(ftp_pwd($conn_id)."<br />"); # Comes back with /

$buff = ftp_nlist($conn_id,"");

ftp_nlist requires a directory name. A blank string is not a directory name.

http://au.php.net/ftp_nlist

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to