How is it possible to set the HTTP header of the link to this file (qqq.lqp)?

f= open(os.path.join(LQS.WEB_SERVER, 'xxx', 'qqq.lqp'), 'w')
f.write(fileInput)
f.close()

return [
    T.a(href="/xxx/qqq.lqp")['Save'],
    webform.renderForms()[FORM_LAYOUT],
]


On Thu, Mar 13, 2008 at 3:23 PM, Maarten ter Huurne <maarten@treewalker.org> wrote:
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

_______________________________________________
Twisted-web mailing list
Twisted-web@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web




--
Suha ONAY

Likya Yazılım ve Bilişim Hizmetleri Ltd.Şti.
Galyum Blok No: B-08
ODTÜ Teknokent
06531 Ankara - Türkiye
Tel :: (312) 210 00 90
Fax :: (312) 210 00 91
Web :: www.ly.com.tr