note 26217 deleted from ref.ftp by didou
| From: | didou@php.net | Date: | Sun, 16 Jan 2005 05:15:24 +0000 |
| Subject: | note 26217 deleted from ref.ftp by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83363@lists.php.net to get a copy of this message | ||
Note Submitter: Marius at lowvoice dot nl
----
if you need to download a file into a string instead of into a file try this:
$temp = tmpfile();
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $user, $pass);
$fget_result=ftp_fget($conn_id, $temp, $ftp_file_name, FTP_ASCII);
ftp_quit($conn_id);
rewind ($temp);
$FILE_DATA=fread($temp,$size);
fclose($temp);
you could also do this with fopen() but I found that using this function will keep the connection
open even after a fclose()!! So repeating this many times will cause a lot of open ftp-connections.