CGI download CSV

Robin Munn rmunn at pobox.com
Sun Nov 10 15:03:26 EST 2002


bromden <bromden at gazeta.pl> wrote:
>> In Mozilla the file open in a browser rather than offering to save to
>> disk
>> In IE the file does nopt open.
> 
> it depends on a browser's settings,
> nothing to do with server side

Only partially correct. It depends on two things: what MIME content-type
is set by the server, and what the browser does with that MIME
content-type. The server configuration files can be set to set certain
content types for certain extensions -- for Apache, the mod_mime module
handles this (see http://httpd.apache.org/docs/mod/mod_mime.html,
especially the TypesConfig and AddType directives). Then the browser
decides what to do with the file based on its MIME type. [*] A file with
a MIME content-type of text/plain, for example, will almost always be
displayed in the browser. So if you want Mozilla to offer to save the
file, you should change the server settings so that .csv files will be
presented with a content-type of, for example, 'application/x-excel'.

[*] Note that you can't rely on Internet Explorer doing things right;
sometimes it seems to ignore the MIME type. It would seem that
Microsoft, in their infinite wisdom, decided to do things their own way
instead of following established standards. See this for more details:

    http://lists.over.net/pipermail/mod_gzip/2001-November/005690.html

-- 
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838



More information about the Python-list mailing list