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.

Are you sure that the $contents is identical?

Be a part of the DaniWeb community

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