[nycphp-talk] Force File Download HTTP Headers and IE Issue
Brian Pang
bpang at bpang.com
Wed Sep 3 17:16:10 EDT 2003
hmm...
IE 6.0.2 on *blush* Win98 uses the specified filename.
will investigate further
> Brian: On a quick test, this set of headers is forcing a Save As... dialog
> on my IE6 on WINXP. Good so far. But the filename is the name of the php
> page that sent down the headers and then the save fails.\
>
> The following MS page contains a discussion of the issue I am having with
> your headers an d additional links to more known issues surrounding force
> download and IE:
>
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:
> 80/support/kb/articles/Q279/6/67.ASP&NoWebContent=1
>
> Thanks.
>
> PSaw
>
> -----Original Message-----
> From: Brian Pang [mailto:bpang at bpang.com]
> Sent: Wednesday, September 03, 2003 4:36 PM
> To: psaw at pswebcode.com; NYPHP Talk
> Subject: Re: [nycphp-talk] Force File Download HTTP Headers and IE Issue
>
>
> I think this has been addressed in the archives already..
> but maybe not specific to PDF
>
> this works for me. Still prompts to save, but fills in the filename.
Does it
> work for you?
>
>
> header("Cache-Control: no-cache, must-revalidate");
> header("Pragma: no-cache");
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=\"$filename\"");
> $fd=fopen("$filePath","r"); fpassthru($fd);
>
>
> > My question:
> > Anyone got a working runaround suggestion to force file downloads on
> > IE?
> >
> > My issue(s):
> > I am using PHP to write HTTP headers to force pdf file download to
> > user roughly as follows:
> >
> > blah, authenticate user, blah, select $file, blah... then push with...
> >
> > header ("Content-Type: application/octet-stream");
> > header("Content-Transfer-Encoding: Binary");
> > header("Content-Length: $iFileSize");
> > header ("Content-Disposition: attachment; filename=$iFileName");
> > readfile("$file");
> >
> > Netscape conforms and opens the Save As... dialog as expected. IE6
> messes up
> > the content-disposition header and opens the download inline in the
> browser
> > without prompting user to Save As...
> >
> > Seems regardless, of content-type header specified:
> > application/octet-stream application/force-download
> > application/pdf
> >
> > IE will mess it up. This is a known issue. Best run around I've seen
> so far
> > is to .Zip the files, in which case IE offers the Save As... on the
> > download. Don't want to zip em.
> >
> > Thoughts?
> >
> > Warmest regards,
> >
> > Peter Sawczynec, Technology Director
> > PSWebcode -- Web Development and
> > Site Architecture
> > psaw at pswebcode.com
> > www.pswebcode.com
> > 718.543.3240
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
> >
> >
>
>
>
>
>
>
More information about the talk
mailing list