> -----Original Message-----
> From: Michael Satterwhite [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 21, 2006 12:11 PM
> To: Kristen G. Thorson
> Subject: Re: [PHP] Stream download problem
>
> Kristen G. Thorson wrote:
> >>-----Original Message-----
> >>From: Michael Satterwhite [mailto:[EMAIL PROTECTED]
> >>Sent: Tuesday, June 20, 2006 8:32 PM
> >>To: PHP Users
> >>Subject: [PHP] Stream download problem
> >>
> >>I have a site that generates a file to be streamed down. The
relevant
> >>code is:
> >>----------------------------------------------------------
> >>header("Content-type: application/vnd.ms-excel");
> >>header("Content-disposition: attachment;
filename=$EXPORT_TIME.txt");
> >>header("Content-disposition: attachment");
> >
> >
> >
> >
> > You're overwritting the Content-disposition header with one that
doesn't
> > supply a suggested filename. The first Content-disposition header
is
> > not being sent at all, so IE is guessing at a filename. Take a look
at
> > the headers your browser is receiving. You'll probably find that's
> > what's going on.
>
> I must be missing something. The line
>
> header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
>
> *IS* supplying the suggested filename. $EXPORT_TIME had been created
> earlier in the script - but even .txt would have been a legal (albeit
> dumb and unintended) filename - hidden in real OS's, but it's legal.
>
> Where is the filename being omitted?
> I appreciate the help.
You're overwriting that line with:
header("Content-disposition: attachment");
http://us2.php.net/manual/en/function.header.php
By default, if you supply two headers of the same type, you're
overwriting the first with the last (see the second parameter of
header()). I don't know if there's configure setting that changes that
behavior, but if I run your code on my server, the ONLY
Content-disposition header I get is:
Content-disposition: attachment
I do not get the other one that sets the filename.
kgt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php