I'm using the following: RESPONSE.headers['Content-Type'] = "text/csv" RESPONSE.headers['Content-Disposition'] = "inline; \ filename=salesdat.csv" RESPONSE.flush() in an attempt to get the browser to prompt the user to save the file to disk instead of displaying it in the browser. Problem is, the browser always displays the file. I've checked that the expected headers are coming through with a sniffer, and they are. I expect I'm not producing the headers right, or what I want to do isn't possible. Any ideas? TIA Bill Scherer Bell Atlantic Mobile PS. this is not Zope'd yet, it's vanilla Bobo.
On 28 Dec 1998 BScherer@mobile.bam.com wrote:
I'm using the following:
RESPONSE.headers['Content-Type'] = "text/csv" RESPONSE.headers['Content-Disposition'] = "inline; \ filename=salesdat.csv" RESPONSE.flush()
in an attempt to get the browser to prompt the user to save the file to disk instead of displaying it in the browser. Which types are saved and which are displayed is browser specific. In fact, I've had reports that seem to indicate that IE defaults to view for an unknown type, and NS defaults to saving.
Use something like application/binary or so. Andreas -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
On Mon, 28 Dec 1998, Andreas Kostyrka wrote:
In fact, I've had reports that seem to indicate that IE defaults to view for an unknown type, and NS defaults to saving.
Use something like application/binary or so.
Urk. I hate having to lie about MIME types. If you are using a filesystem which supports MIME types, what the server reports is what the browser will save the file as. Is there any other way to indicate a document is to be saved? Mike. -- --- | Mike Pelletier Work: 519-746-1607 /opeware! | Software Developer Home: 519-725-7710 --- | mike@zopeware.com Fax: 519-746-7566 http://www.zopeware.com | Zopeware is not endorsed by Digital Creations
On Mon, 28 Dec 1998, Mike Pelletier wrote:
On Mon, 28 Dec 1998, Andreas Kostyrka wrote:
In fact, I've had reports that seem to indicate that IE defaults to view for an unknown type, and NS defaults to saving.
Use something like application/binary or so.
Urk. I hate having to lie about MIME types. If you are using a filesystem which supports MIME types, what the server reports is what the browser will save the file as. Is there any other way to indicate a document is to be saved? Not that I know. I don't remember reading something like this in the the HTTP/1.1 RFC too. You could try playing around with JavaScript (perhaps), but that seems (even if it works) like a worse solution than lying.
(The only OS I know that knows about file types on the FS level is MacOS, and it doesn't know MIME types, as HFS predates MIME a bit ;) ) Andreas -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
On Mon, Dec 28, 1998 at 06:55:16PM +0100, Andreas Kostyrka wrote:
(The only OS I know that knows about file types on the FS level is MacOS, and it doesn't know MIME types, as HFS predates MIME a bit ;) )
BeOS uses MINE types as its native file-type system, but obviously, it's quite new in comparison to MacOS. I've got BeOS on my PC at home, but haven't played with it in a bit, need to take a look at Zope on it, since it's got GREAT thread handling. Chris -- | Christopher Petrilli | petrilli@amber.org
Christopher G. Petrilli wrote:
BeOS uses MINE types as its native file-type system, but obviously, it's quite new in comparison to MacOS. I've got BeOS on my PC at home, but haven't played with it in a bit, need to take a look at Zope on it, since it's got GREAT thread handling.
Since there seems to be a fully-functional Python for BeOS (has sockets and such), Zope with the ZopeHTTPServer should Just Work. Maybe when things slow down a bit I'll try it.
BScherer@mobile.bam.com wrote:
I'm using the following:
RESPONSE.headers['Content-Type'] = "text/csv" RESPONSE.headers['Content-Disposition'] = "inline; \ filename=salesdat.csv"
Don't set headers via the headers attribute. (I should rename this attribute, '_headers'. :) Use the setHeader method instead. Or just: RESPONSE[Content-Type'] = "text/csv" RESPONSE['Content-Disposition'] = "inline; \ filename=salesdat.csv" Jim -- Jim Fulton mailto:jim@digicool.com Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
To return to an old thread....I've been trying to achieve the equivalent of the code below in DTML. Since you can't make assignments in DTML, I've been trying the following.... <!--#call "_['RESPONSE'].setHeader('Content-Type','application.binary')"--> <!--#call "_['RESPONSE'].setHeader('Content-Disposition','inline;filename=phoneBook.cs v')"--> IE4 opens up a window and looks as if it's about to download a file, but then the message ... 'The downloaded files is not available. This could be due to Security or Language settings or because the server was unable to retrieve the selected file'. I've tried text/csv as the Content-Type as well and get the same error. It also says that it's trying to download the name of the document, 'displayAll' and not the desired filename, 'phoneBook.csv' Anyone any ideas? Cheers, Andy.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jim Fulton Sent: Monday, December 28, 1998 4:12 PM To: BScherer@mobile.bam.com Cc: zope@zope.org Subject: Re: [Zope] - RESPONSE.headers Help needed
BScherer@mobile.bam.com wrote:
I'm using the following:
RESPONSE.headers['Content-Type'] = "text/csv" RESPONSE.headers['Content-Disposition'] = "inline; \ filename=salesdat.csv"
Don't set headers via the headers attribute. (I should rename this attribute, '_headers'. :)
Use the setHeader method instead. Or just:
RESPONSE[Content-Type'] = "text/csv" RESPONSE['Content-Disposition'] = "inline; \ filename=salesdat.csv"
Jim
-- Jim Fulton mailto:jim@digicool.com Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (7)
-
Andreas Kostyrka -
Andy Smith -
BScherer@mobile.bam.com -
Christopher G. Petrilli -
Jim Fulton -
Mike Pelletier -
Ty Sarna