NYCPHP Meetup

NYPHP.org

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

Chris Snyder csnyder at chxo.com
Wed Sep 3 21:34:49 EDT 2003


Excellent explanation, Marc!

It's true that the mime-type should always be an accurate description of 
the file, but application/octet-stream is accurate, if overly general. 
Perhaps what was missing from Macintosh's Classic metadata handling was 
a way for the user to easily change the filetype, by adding a .pdf to 
the filename, for example? (it's been a long time...)

The reson for the behavior, while not explained, is set forth in RFC 
2616, the HTTP 1.1 specification:

   "If this header [Content-disposition: attachment] is used in a response 
   with the application/octet-stream content-type, the implied suggestion 
   is that the user agent should not display the response, but directly 
   enter a `save response as...' dialog."

Otherwise, the browser is only supposed to use the Content-disposition 
header for discovering the file name in case the user wants to save the 
file after viewing it.

If you're really curious, that's on about page 170 of 
ftp://ftp.isi.edu/in-notes/rfc2616.txt  (thank you, Mozilla, for 
type-ahead find!)

   chris.




More information about the talk mailing list