On Monday, October 9, 2017 at 1:42:59 AM UTC-4, Andy W wrote:
>
> Hi Rudy
>
> Have you tried re-defining the download function to include the path to the
> location you have used for storing the uploaded files? For example, in my
> case I ended up with the following in my controller:
>
> def download():
>     import os
>      file_path = os.path.join(request.folder,'uploads', str(auth.user.
> client), request.args(0))
>      return response.stream(open(file_path), attachment=False, chunk_size=
> 4096)
>
>
This shouldn't be necessary. As long as you have the client id available in 
the request (e.g., in auth.user.client), you can simply use it to specify 
the uploadfolder when defining the model. In db.by:

db.define_table('company',
    Field('logo', 'upload', label='Company Logo',
          uploadfolder=os.path.join(request.folder, 'uploads', auth.user.client 
if auth.user else ''),
          uploadseparate=True, autodelete=True)),
    ...)

Anthony

-- 
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/d/optout.

Reply via email to