I'm not too sure of what is going on, but I was able to ftp one image file anyone know why the rest weren't ftped?
And, does any know how to put the file into the correct directory?
The following was able to ftp the first file in the source_dir into the directory the script exists in.
I would like to ftp all the files - not just one - to the destination_dir - not the dir holding the script, that are in the source_dir and not in the destination_dir.
let me know if you have any questions
$source_dir = '/server_A/images';
$destination_dir = '/server_B/folder/lgpics';
//ftp's all image files
$destination_list = ftp_nlist($destination_conn, $destination_dir);
$source_list = ftp_nlist($source_conn, $source_dir);
echo 'everythings okay so far.<br/>';
foreach ($source_list as $source_filename) {
echo "$source_filename<br/>";
if (!file_exists($destination_dir.$source_filename)) {
echo "$destination_filename<br/>";
$clean = explode("/", $source_filename);
$fp = fopen($clean[3], 'w');
$files = ftp_fget($source_conn, $fp, $source_filename, FTP_BINARY);
if (!$files) {
echo 'I tried to ftp the files<br/>';
exit;
} else { echo 'files transfered<br/>'; exit; }
}
}