I am trying to upload file to FTP server using php but it is not getting uploaded.
Code:
$response =<<<RESPONSE
<cdm:Response>
<cdm:header exportTime="{$export_time}" baseVersion="{$baseline_snapshot_id}" version="{$this->snapshot_id}">
<cdm:countryCode>{$this->domain}</cdm:countryCode>
<cdm:description>{$description}</cdm:description>
<cdm:environment>{$destination}</cdm:environment>
<cdm:name>{$name}</cdm:name>
</cdm:header>
<cdm:Status>{$this->status}</cdm:Status>
</cdm:Response>
RESPONSE;
$handler = fopen($log_file_name, 'w');
fwrite($handler, $response);
fclose($handler);
$server = "adoshi.dev.com";
$ftp_user_name = "adoshi";
$ftp_user_pass = "*******";
#$source = $handler;
$mode = "FTP_ASCII";
$dest = "/home/adoshi/ftp_folder";
$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
if (!$connection || !$login) { die('Connection attempt failed!'); }
$upload = ftp_nb_put($connection, $dest, $handler, $mode);
if (!$upload) { echo 'FTP upload failed!'; }
ftp_close($connection);
I have provided all login credentials proper and so still wondering that why it is not uploading to remote server using php.
Any guidance would be highly appreciated.