note 26217 added to ref.ftp
| From: | Marius at lowvoice dot nl | Date: | Tue, 22 Oct 2002 19:51:04 +0000 |
| Subject: | note 26217 added to ref.ftp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38433@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/ref.ftp.php
http://master.php.net/manage/user-notes.php?action=edit+26217
http://master.php.net/manage/user-notes.php?action=delete+26217
http://master.php.net/manage/user-notes.php?action=reject+26217