say you have
db.define_table('myfile',Field('path'))
you can create an action like:
def serve_myfile():
import os
file_id=request.args(0)
row=db.myfile[file_id]
root_path = '/path/to/root/of/paths/'
return
response.stream(open(os.path.join(root_path,row.path),'rb'))
and call it with http://...../serve_myfile/2
On 26 Mar, 13:08, psikahtik <[email protected]> wrote:
> Newb question (trying to learn Python and web2py simultaneously).
> I've currently got a MySQL database containing records with file paths
> to a whole lot of images and scanned files in a deeply nested folder
> structure. I just want to build a simple search page to retrieve those
> scans. However, I'm unsure as how to go about building the download
> link with URL() and the existing download function. I'm guessing I
> probably need to write my own download function but I can't find any
> examples of this situation. Can anybody point me in the right
> direction here?
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
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/web2py?hl=en.