Re: Download
| From: | Kris Dahl | Date: | Mon, 19 Jun 2000 20:58:00 +0000 |
| Subject: | Re: Download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2241@lists.php.net to get a copy of this message | ||
on 6/19/00 12:44 PM, Jason Granum at razm@caesius.com wrote:
> I'm trying to make a .php script which when run will pop up the IE/netscape
> save or run popup, then save it. I have .tgz files I want users to be able to
> download through the php file.
>
> My question is how do I make this work? I'm trying to do this:
>
> <?
> $fp = fopen("/home/files/file.tgz","r");
> Header("Content-type: application/x-gtar");
> fpassthru($fp);
> ?>
>
> however this just puts the binary content in the IE browse window instead of
> promping to download it.
You need to set the Content-disposition header.
header( "Content-Disposition: attachment; filename=$filename" );
-k