ftp_put() problem

From: Date: Wed, 15 Dec 2004 16:54:08 +0000
Subject: ftp_put() problem
Groups: php.general 
Request: Send a blank email to php-general+get-204414@lists.php.net to get a copy of this message
I'm trying to FTP a string value as a file without writing it to the local server as a file, but I can't get ftp_put() to work. If I read a file from the server, ftp_fput() works: $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

« previous php.general (#204414) next »