In the base page, I served the xxx directory for static files with the
following lines.
def child_xxx(self, ctx):
return static.File(os.path.join(LQS.WEB_SERVER, 'xxx'))
On the page that will serve a link to the file, the file is saved to the xxx
directory and a link is given:
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],
]
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?
Thanks.
On Wed, Mar 12, 2008 at 7:16 PM, Adrian Perez <[EMAIL PROTECTED]>
wrote:
> On Wed, 12 Mar 2008 08:55:37 +0200
> "Suha Onay" <[EMAIL PROTECTED]> wrote:
>
> > Yes Daniel is right.
> > Sorry about the wrong question.
> > I am talking about providing a link to some downloadable content,
> > e.g., a spreadsheet or an image. How is it possible in nevow?
> >
> > On Tue, Mar 11, 2008 at 8:51 PM, L. Daniel Burr <[EMAIL PROTECTED]>
> > wrote:
> >
> > > On Tue, 11 Mar 2008 13:37:08 -0500, <[EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > > On 04:31 pm, [EMAIL PROTECTED] wrote:
> > > >> I am a newbie of nevow. I want to open a save as dialog and
> > > >> enable the user
> > > >> to save files.
> > > >
> > > > Are you talking about uploading a file to the server, or saving a
> > > > file on the client? (You can't save files on the client in a web
> > > > browser in any way that I'm aware of.)
> > > >
> > >
> > > I think the OP is talking about providing a link to some
> > > downloadable content, e.g., a spreadsheet or an image, that should
> > > trigger the browser's download behavior.
>
> You should use nevow.static.File, a quick example (save in example.tac
> and run with "twistd -noy example.tac"):
>
> from nevow import static, appserver
> from twisted.application import service, internet, strports
>
> application = service.Application("example")
> site = appserver.NevowSite(
> resource=staic.File("thing.jpeg", "image/jpeg"))
> server = strports.service("tcp:8080", site)
> server.setServiceParent(application)
>
> You can construct a nevow.static.File passing a path to a directory,
> and you will be serving all the contents of the directory.
>
> Cheers,
>
> --
> ~
> ~
> ~
> ".signature" 4 lines, 50 characters written
>
> _______________________________________________
> Twisted-web mailing list
> [email protected]
> 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
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web