Not quite. Instead of using the default download() action to get these
files use something like:

def mydownload():
    filename=request.args(0)
    user_id=db(db.table.myfile==filename).select().first().user_id
    db.table.myfile.uploadfolder=os.path.join
(request.folder,'uplods',str(user_id))
    return response.download(request,db)

Hope it makes sense.

You can make this faster by replacing the last line with the source
code of response.download and making sure there is no duplicate access
to the same record. You may also need to catch possible exceptions so
you do bot get tickets if the file or folder is not there.

On Jan 11, 8:39 pm, weheh <[email protected]> wrote:
> Thanks, Massimo, now we're talking. In my case, the folder name is
> already stored in the record as Field('user_id',auth_user). The
> subfolder is this user_id. Are you saying, instead, that the filename
> encoded into Field('myfile',upload) should have this user_id encoded
> into the upload filename stored in myfile? If so, what do I have to
> read to figure out how to do that? Where's the best place to look at
> examples or doc on how to write my own download function?
-- 
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.


Reply via email to