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

Suha Onay suha at ly.com.tr
Thu Mar 13 09:46:44 EDT 2008


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

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

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


On Thu, Mar 13, 2008 at 3:23 PM, Maarten ter Huurne <maarten at 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 at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>
>


-- =

Suha ONAY

Likya Yaz=FDl=FDm ve Bili=FEim Hizmetleri Ltd.=DEti.
Galyum Blok No: B-08
ODT=DC Teknokent
06531 Ankara - T=FCrkiye
Tel :: (312) 210 00 90
Fax :: (312) 210 00 91
Web :: www.ly.com.tr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20080313/78=
159197/attachment.htm


More information about the Twisted-web mailing list