Created
October 17, 2011 23:12
-
-
Save jehoshua02/1294145 to your computer and use it in GitHub Desktop.
I don't think unlink() and ftp_put() are playing nice...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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