Hello,
I have pasted an ftp program that I am putting together. You will see in the code that I change to a directory on the ftp server. I then want to copy all of the contents of this locally.
Can anyone help please ? I have also pasted my vars.php as well.
ftp.php
<?php
// set up basic connection
include ("vars.php");
$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 $ftp_user_name";
exit;
} else {
echo "<b>Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
$download = ftp_get($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$download) {
echo "Unable to download $source_file";
} else {
echo "<br><b>Downloaded $source_file to $ftp_server as $destination_file<br>";
}
// try to change the directory to source_image_folder
if (ftp_chdir($conn_id, $source_image_folder)) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
?>
vars.php
<?php
$ftp_server="www.bluetouch-online.co.uk";
$ftp_user_name="ftp.bluetouch-online.co.uk";
$ftp_user_pass="bluetouch";
$source_file="btt.xml";
$destination_file="c:/projects/jordons/temp.xml";
$source_image_folder="images";
$destination_image_folder="c:/projects/jordons/images";
?>
THANY YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!