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".


$countfiles = 0;

$conn_id = ftp_connect("");

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


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



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



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

 // print_r($buff);

$contents = ftp_nlist($conn_id, "lib/images/");
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.

Are you sure that the $contents is identical?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.