[Twisted-web] Nevow-Stan How to save file?

Maarten ter Huurne maarten at treewalker.org
Thu Mar 13 09:23:42 EDT 2008


On Thursday 13 March 2008, Suha Onay wrote:

> I run this page from Firefox, IE and IE Mobile.
> I want the browser open a save as dialog but it shows the file within the
> browser.
> How can I achieve this?

You can set the following HTTP header:
  Content-Disposition: attachment; filename
Where "filename" is the suggested name for saving the file.

Note that HTTP headers must be ASCII. It is possible to encode Unicode in 
HTTP headers, but it's a real pain to get it working in all browsers. At 
least, I haven't been able to find a single way of encoding that works for 
IE, Mozilla and Opera, so now I choose a different way of encoding 
depending on the user agent header.

Bye,
		Maarten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20080313/0eab96c4/attachment.pgp


More information about the Twisted-web mailing list