RE: [PHP] Re: File Download Headers
| From: | Kristen G. Thorson | Date: | Fri, 16 Jun 2006 20:10:15 +0000 |
| Subject: | RE: [PHP] Re: File Download Headers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238170@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett@php.net]
> Sent: Friday, June 16, 2006 9:11 AM
> To: tedd
> Cc: ceo@l-i-e.com; Barry; php-general@lists.php.net
> Subject: Re: [PHP] Re: File Download Headers
>
> tedd wrote:
> > Barry says you can use these three:
> >
> > header("Content-Type: application/force-download");
> > header("Content-Type: application/octet-stream");
> > header("Content-Type: application/download");
> >
> > Richard says only use this one:
> >
> > header("Content-type: application/octet-stream");
> >
> > And, you say use both.
>
> Both Content-Type and Content-Disposition.
>
> Richard's example is the correct Content-Type to use. Barry's is no
> different than this:
>
> header('Content-Type: foo/bar');
>
> It's better to use a valid type and to not have superfluous header()
> calls that do nothing.
>
> Hope that helps.
>
> Chris
When you have three lines setting the same header, you're just replacing
one with the other anyways:
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
The actual header being sent for Content-Type in this case is
"application/download". The first two are not sent unless you remember
to use the second parameter of header().
http://us2.php.net/manual/en/function.header.php
kgt