I would do:

def custom_download():
     filename = request.args(0)
     # maybe validate filename
     full_path = os.path.join('/whereever/it/is', filename)
     return response.stream(full_path)

and call with http://..../custom_download/yourfilename

On Wednesday, 5 April 2017 02:44:47 UTC-5, Dave S wrote:
>
> I have a bunch of pix that I want to display, which are not in the uploads 
> directory of the application.  My options appear to be:
>
> - copy them to the static folder (or a subfolder) and have URL() work for 
> them
> - set up streamio on each so I can read them from an arbitrary filesystem 
> location
> - store them as a blob in the database
>
> Is there another option?
>
> If there was just a handful, relatively stable over time, the static 
> option would seem a good idea (because it would be simple to do).  But I 
> took more than 20 shots yesterday (starting with spring hillsides, and then 
> trying to capture birds in flight), and that was just one outing (limited 
> by the memory card). Taking down those pictures before putting up the next 
> set also seems "un-static".
>
> The blob option might be good, but not until I set up a real DB engine 
> (I'm not a DB admin) or use mlabs.  Meanwhile, I'm still on sqlite.
>
> Also, I might want to look into how to cache the images (not because there 
> will be heavy use, but because this might be a good application to use for 
> the learning experience).
>
> Suggestions?
>
> /dps
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to