If you use the built-in upload mechanism (i.e., an "upload" type field in a
db table), then files uploaded via that method can be downloaded via
response.download. The welcome app includes a /default/download function to
do just that. Check
out http://web2py.com/books/default/chapter/29/03/overview#An-image-blog.
Anthony
On Monday, February 10, 2014 4:43:32 PM UTC-5, aapaap wrote:
>
> hello,
>
> maybe I'm totally on the wrong path, but this is my script for the moment:
>
> - users can upload pictures. Uploads seems to be allowed only in
> "myapp/uploads"
>
> - I want to show these images, but images to be shown are only allowed
> in "myapp/static"
>
> - so I have to show images from "myapp/uploads"
>
> I have the following controller:
>
> def Show_Plaatje():
> fh = open ( os.path.join ( 'applications', request.application,
> 'uploads', 'images', 'pic_53.png' ), 'rb')
> data = fh.read()
> fh.close()
> return data
>
> And in my view:
> <img src="{{=URL('Show_Plaatje')}}"/>
>
> This doesn't seem to work, if I look at the resulting html-source, I see
> <img src="/Knutselen_Voor_Kinderen/default/Show_Plaatje">
>
> thanks,
> Stef
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.