Thanks! I was wondering about that.
I changed the code but I still can't get it to work 😕
Do I need a trailing \ on $source_file to get the files inside \EVENT_xxx ?
The /event_images directory does already exist, permissions are 777
Here's my new code with the above change. Thanks again for your help!!!
$source_file = 'C:\Events\EVENT_' . $event_num ;
$destination_file = '/home/cberry/public_html/test1/images/event_images/';
// upload the file
//$fp = fopen($destination_file);
//$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
function ftp_putAll($conn_id, $source_file, $destination_file) {
$d = dir($source_file);
while($file = $d->read()) { // do this for each file in the directory
if ($file != "." && $file != "..") { // to prevent an infinite loop
if (is_dir($source_file."/".$file)) { // do the following if it is a directory
if (!@ftp_nlist($conn_id, $destination_file ."/".$file)) {
ftp_mkdir($conn_id, $destination_file."/".$file); // create directories that do not yet exist
}
ftp_putAll($conn_id, $source_file."/".$file, $destination_file."/".$file); // recursive part
} else {
$upload = ftp_put($conn_id, $destination_file."/".$file, $source_file."/".$file, FTP_BINARY); // put the files
}
}
}
$d->close();
}