Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Created October 17, 2011 23:12
Show Gist options
  • Save jehoshua02/1294145 to your computer and use it in GitHub Desktop.
Save jehoshua02/1294145 to your computer and use it in GitHub Desktop.
I don't think unlink() and ftp_put() are playing nice...
<?php
// ...
// send file to warehouse
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
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 "Connected to $ftp_server, for user $ftp_user_name";
}
$upload = ftp_put($conn_id, $ftp_destination, $ftp_source, FTP_BINARY);
if (!$upload) {
// echo "FTP upload has failed!";
} else {
// echo "Uploaded $source_file to $ftp_server as $destination_file";
unlink($ftp_source);
}
ftp_close($conn_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment