[thelist] RE: Force file download from browser?

Garrett Coakley garrett at polytechnic.co.uk
Wed May 15 13:26:01 CDT 2002

On Wed, 15 May 2002 10:42:29 -0600 "Emilio" <emiliog at telusplanet.net>

> Thank you all for your responses.  Your comments were helpful and
> insightful.  The thing is, all the answers suggested I set the MIME
> type to application/octet-stream...but none actually explained how to
> SET the MIME type to that.  So I have to ask, "How do you set the MIME
> type of the document or link to application/octet-stream?"  DO I just
> add a"type" property??

The mime type is set by the server when it sends the file. This is
either taken care of by the web server through a mime-type file type
system or in your application logic.

With Apache the mime file is usually in
$APACHEROOT/conf/apache-mime.types (depending on the distribution):

[root at leon updates]# more /etc/httpd/conf/apache-mime.types
# This is the default mime.types file from the Apache web server
# distribution
application/pdf                 pdf

With application logic it'll depend on the language you are using, for
instance, with PHP you would send a header directive

header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=downloaded.pdf");

/* ... output pdf file ... */




WORK: http://spiked.co.uk/
PLAY: http://polytechnic.co.uk/

More information about the thelist mailing list