$fh = fopen("test.txt", "r"); $upload = ftp_fput($conn_id, $destination_file, $fh, FTP_ASCII); if(!$upload) { echo "<p>FTP upload has failed!</p>\n"; } else { echo "<p>Uploaded to ".$ftp_server." as ".$destination_file."</p>\n"; }
But trying to avoid writing to the local server by using ftp_put() instead, this does not work:
$source = "This is a test file. This is a test file.\nThis is a test file.";
$upload = ftp_put($conn_id, $destination_file, $source, FTP_ASCII);
I don't understand why ftp_put() isn't able to use $source as a string value, but substituting ftp_fput() into the script and using a file handle does work. I'm trying to avoid writing a file to the local server just to be able to use ftp_fput().
-- Lowell Allen
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php