<?

$conn = ftp_connect( $_POST['remote_host'] ); 

wpTimeMachine_logger( $use_log,  '--- create ftp connection ' );
                               
ftp_login( $conn, $_POST['remote_user'], $_POST['remote_pass'] );  

wpTimeMachine_logger( $use_log,  '--- login to ftp ' );

if ($timestamp != "") {
    $remote_path = "/" . $_POST['remote_path'] . "/wpTimeMachine-" . $timestamp;
} else {
    $remote_path = "/" . $_POST['remote_path'];
}

@ftp_mkdir($conn, $remote_path);
               
ftp_chdir( $conn, $remote_path );                            

$remote_file = baseName( super_archive.$format );

if ($_POST['remote_path'] == "") {
    $remote_file = "/" . $remote_file;
} else {
    $remote_file = "/" . $remote_path . "/" . $remote_file;
}

ftp_put($conn, $remote_file, super_archive.$format, FTP_BINARY);
ftp_quit( $conn );    
        
?>
