To return a pdf , simply open and .read() the data into a buffer, then
return the buffer directly

class download:
    def POST(self):
        web.header('Content-Type', 'application/pdf')

        web.header('Content-Disposition,'filename=test.pdf')

       #This is inefficient!!! Don't .read() the file every request in
production!!

       data = open('/home/shawn/test', 'rb').read()

       return data
On Oct 17, 2014 8:20 PM, "Pritesh Modi" <[email protected]> wrote:

> Hi everyone
>
> i am new to this group and first time using it  webpy module
>
> my requirement is by click on there is no of task attachment file names
> details showing with that also showing download button now on action click
> post request send to server side process for from specific location by
> matching file name read the file and response for file downloading.
>
> but i am confuse here.
>
> on click on download button my post request come to server side function.
>
> but  i stuck from here can anyone advice if used it.
>
>
> here is my latest code let me now specific changes required.
> class download:
>     def POST(self):
>
>         web.header('Content-Type', 'application/pdf')
>         #raise
> render.index('/home/sameer/Downloads/openerp-7.0-20140804-231303/openerp/filestore/joh_test/e77/e7720b5c7c7da521b7862dcbd3c94e2e7f4b0734.pdf')
>         fullpath='/home/shawn/test'
>         return http.url(fullpath)
>
>
>
>
> Thanks
>
>  --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/webpy.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to