note 13098 modified in function.ftp-get by zak
| From: | zak@php.net | Date: | Tue, 13 Nov 2001 14:09:50 +0000 |
| Subject: | note 13098 modified in function.ftp-get by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20792@lists.php.net to get a copy of this message | ||
If you want download the file to the client, use the function FTP_fgets
Look at this:
header("Content-disposition: filename=$file");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
$fp = @fopen("$file", "w");
ftp_fget($ftp,$fp,"$file",FTP_BINARY) OR DIE("Erreur: Le fichier $file n'a pas
pu être mis en cache sur notre serveur.\r\nNous ne pouvons donc vous transférer le
fichier.\r\nVeuillez nous en excuser.");
@fclose($fp);
$fp = @fopen("$file","r");
while(!feof($fp))
{
$lignes .= fgets($fp,4096);
}
echo $lignes;
@fclose($fp);
unlink("$file");
The file will be download by the server, sent to the client and delete from the server.
--was--
No No.
If you want download the file to the client, use the function FTP_fgets
Look at this:
header("Content-disposition: filename=$file");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
$fp = @fopen("$file", "w");
ftp_fget($ftp,$fp,"$file",FTP_BINARY) OR DIE("Erreur: Le fichier $file n'a pas
pu être mis en cache sur notre serveur.\r\nNous ne pouvons donc vous transférer le
fichier.\r\nVeuillez nous en excuser.");
@fclose($fp);
$fp = @fopen("$file","r");
while(!feof($fp))
{
$lignes .= fgets($fp,4096);
}
echo $lignes;
@fclose($fp);
unlink("$file");
The file will be download by the server, sent to the client and delete from the server.
http://www.php.net/manual/en/function.ftp-get.php