NYCPHP Meetup

NYPHP.org

[nycphp-talk] Force File Download HTTP Headers and IE Issue

Brian Pang bpang at bpang.com
Wed Sep 3 16:44:52 EDT 2003


that code snippet I posted should work similarily for jpgs or anything
else...



> I may be wrong, but I think the only reason you're seeing the save 
> as... dialog in Netscape is because the Adobe Acrobat web browser 
> plugin doesn't run in Netscape anymore.  AFAIK (and according to the 
> system requirements), Acrobat seems to be implemented in ActiveX now, 
> which will only work (on Windows) in IE.
> 
> http://www.adobe.com/products/acrobat/acrrsystemreqs.html#60win
> 
> So what I'm saying is that your script isn't what's controlling this; 
> if the plugin was functioning in Netscape, NS would display it 
> inline, too.
> 
> To illustrate this, forget about PDF for a second, and pretend it's a 
> JPEG.  Try forcing a download of a JPEG.  I don't believe you can do 
> it, because the client-side browser controls how it will handle JPEGs 
> (i.e., whether it will display inline or send to another viewer).
> 
> Of course, as I said, I may be wrong.  :)
> 
> Marc Antony Vose
> http://www.suzerain.com/
> 
> The cost of liberty is less than the price of repression.
> -- W.E.B. Du Bois
> 
> 
> 
> 
> >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
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 






More information about the talk mailing list