Hi, this is how I stream the file:

    def GET(self):
        # assuming we have selected doc from the database
        web.header("Content-Disposition", "attachment; filename=%s" % 
doc.filename)
        web.header("Content-Type", doc.filetype)
        web.header('Transfer-Encoding','chunked')
        f = open(doc.filename, 'rb')
        while 1:
            buf = f.read(1024 * 8)
            if not buf:
                break
            yield buf

On Friday, October 12, 2012 4:48:02 AM UTC+4, Jason Macgowan wrote:
>
> Hello,
>
> I have a web app that accepts requests, and based on the request it builds 
> a zip file.  How can I get web.py to yield this file?
>
> I tried something along the lines of
>
> def GET(self):
>     return open('/path/to/file')
>
> But that doesn't work, and is probably not even close to the right 
> direction to go.
>
> Any advice?
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/JmLhmIiJKC8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to