[Gllug] CGI Scripts/Apache
t.clarke
tim at seacon.co.uk
Mon Mar 11 11:00:26 UTC 2002
-------------------------------------------
Message from:-
Tim Clarke (tim at seacon.co.uk)
Seacon Group Ltd / Seacon Terminals Ltd,
Tower Wharf, Northfleet, Kent, DA11 9BD, UK
Telephone: +44 (0)1474 320000
Fax: +44 (0)1474 329946
-------------------------------------------
Hi
This is sort of Linux related, in that it relates to CGI programs running
on a Linux apache server:-
I need to output a dynamic web-page response from a cgi 'script' in 'csv'
text format, such that instead of displaying on the browser screen it
saves into a file.
The method I am using, which works fine with non-ascii file-content is as
follows:-
Send HTTP Headers:
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=zzzzzz.csv
followed by a blank line
followed by the data
Using netscape as the browser this works and a 'box' opens up offering
the choice to save to disc.
Using Internet Explorer as the browser, it seems to ignore the headers and
treat the content as plain text; displaying it on the screen.
Havn't yet tried it with Mozilla, but suspect it will work the same as Netscape.
So my question is:
a) Are the headers wrong ?
b) Any suggestions as to what they should be to work properly with Explorer
Incidentally I can 'force' Explorer to save the file as a binary by outputting
a chunk of binary zeroes at the front of the csv file; but this screws up
Excel when it tries to open the file !
Any pointers/help appreciated
Tim
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list