Okay folks, first of all thankyou for your time. I am running this script on a redhat 7.1 machine. I am running the latest (as of 4 days ago) stable releases of apache, php etc. and FTP is enabled.
My script downloads from the root directory of the ftp site but gives the following error MSG when trying to download from /in/:
----MY SCRIPT----
<?php
$ftp_server = "XXX.XXX.XXX.XXX";
$ftp_user_name = "*****";
$ftp_user_pass = "*****";
// set up a connection
$conn_id = ftp_connect("$ftp_server");
// login with username and password
$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass");
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user";
}
ftp_pasv($conn_id, pasv);
//changes directory to in
ftp_chdir ($conn_id, "in");
//spits out a list of files
$dir= ftp_pwd($conn_id);
$list=Array();
$list=ftp_nlist($conn_id, "$dir");
$i=0;
//starts downloading all files that were listed
do
{
$file = $list[$i];
print "\n";
print "$file";
ftp_get($conn_id, "$file", "$file", FTP_BINARY);
//ftp_delete($conn_id, "$file");
$i++;
}
while($list[$i]);
// close the FTP stream
ftp_quit($conn_id);
?>
----END OF SCRIPT----
This is the error I get: warning: error opening /in/filename in test.php on line 38
Remember if I try and access files from the root of this ftp account, this script works fine. Its when I try to download from /in/filename then I get problems.