ftp problems
Posted: Fri Mar 14, 2003 9:06 am
I am having a problem with an ftp connection on a unix server.
The above code echoes
It seems it is connecting and logging in but cannot see the directories and files that are there. (They are there. I use WS_FTP and can see them.)
What am I missing?
Code: Select all
<?php
// set up basic connection
$conn_id = ftp_connect("www.sitename.com");
if (!$conn_id)
echo "FTP connection not made successfully.";
else
{
// login with username and password
$login_result = ftp_login($conn_id, "username", "password");
// check connection
if (!$login_result)
echo "FTP connection has failed!";
else
{ echo "Connected to proper server.";
echo ftp_pwd($conn_id);
echo "<br>";
ftp_chdir($conn_id, "newdir");
echo "<br>";
ftp_get($conn_id, "C:/Temporary/filename.doc", "filename.doc", FTP_BINARY);
echo "<br>";
ftp_get($conn_id, "C:/Temporary/filename.doc", "newdir/filename.doc", FTP_BINARY);
echo "<br>";
}
// close the FTP stream
ftp_close($conn_id);
}
?>A call to ftp_nlist($conn_id, "/"); returns an empty list.Connected to proper server
/
Warning: ftp_chdir(): newdir: No such file or directory.
Warning: ftp_get: filename.doc: No such file or directory.
Warning: ftp_get: newdir/filename.doc: No such file or directory.
It seems it is connecting and logging in but cannot see the directories and files that are there. (They are there. I use WS_FTP and can see them.)
What am I missing?