0

Hi..
I used the following code to download a file from fedora 14 FTP configured(VSFTP) to local machine(Fedora 14).
The same code worked fine in windows machine.

In fedora machine it listing all the files,but not downloading the files.Showing the error like following

"There was a problem".

<?php

$countfiles = 0;



$conn_id = ftp_connect("192.16.30.2");





$login_result = ftp_login($conn_id, "usertest", "password");

if($login_result){

printf("****We are now connected****");

printf("<br>");

}else{

printf("****Connection faild****");

printf("<br>");

}





//$buff = ftp_rawlist($conn_id, '/var/www/html/');





 // print_r($buff);

$contents = ftp_nlist($conn_id, "lib/images/");
 print_r($contents);
 $server_file="lib/images/".basename($contents[6]);
echo  "<br>serverfile==".$server_file;
echo $local_file= $server_file;
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {

    echo "Successfully written to $local_file\n";

} else {

   echo "There was a problem\n";

}     





?>

No problem with the connection and directory listing.

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.