# wp-database-backup/6.11/includes/admin/Destination/FTP/sendaway.php

WP Database Backup – Unlimited Database &amp; Files Backup by Backup for WP, version 6.11. 46 lines.

- Page: https://pluginprobe.com/plugins/wp-database-backup/6.11/code/includes/admin/Destination/FTP/sendaway.php
- Raw: https://pluginprobe.com/plugins/wp-database-backup/6.11/raw/includes/admin/Destination/FTP/sendaway.php
- Modified: 2024-06-13T10:44:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-database-backup/6.11/code/includes/admin/Destination/FTP/sendaway.php#L10-L20`.

```php
<?php
/**
 * Destination ftp
 *
 * @package wpdbbkp
 */

// Set up variables.
$host          = get_option( 'backupbreeze_ftp_host' );
$user          = get_option( 'backupbreeze_ftp_user' );
$pass          = get_option( 'backupbreeze_ftp_pass' );
$subdir        = get_option( 'backupbreeze_ftp_subdir' );
$wp_upload_dir = wp_upload_dir();

$wp_upload_dir['basedir'] = str_replace( '\\', '/', $wp_upload_dir['basedir'] );
$remotefile               = $subdir . '/' . $filename;
$localfile                = trailingslashit( $wp_upload_dir['basedir'] . '/db-backup' ) . $filename;
if ( isset( $host ) && ! empty( $host ) && isset( $user ) && ! empty( $user ) && isset( $pass ) && ! empty( $pass ) ) {
	// See if port option is blank and set it to 21 if it isn't.
	if ( ! get_option( 'backupbreeze_ftp_port' ) ) {
		$port = '21';
	} else {
		$port = get_option( 'backupbreeze_ftp_port' );
	}
	$conn = ftp_connect( $host, $port );
	if ( $conn ) {
		$result = ftp_login( $conn, $user, $pass );
		if ( $result ) {
			// Switch to passive mode.
			ftp_pasv( $conn, true );
			// Upload file.
			$success = ftp_put( $conn, $remotefile, $localfile, FTP_BINARY );
			if ( $success ) {
				$args[2] = $args[2] . '<br> Upload Database Backup on FTP ' . $host;
				$args[4] = $args[4] .= 'FTP, ';
			}
		}
	}
	// Close connection to host.
	if(!is_bool($conn)){
		ftp_quit( $conn );
	}
	
}


```
