ftp_put() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux