On Sunday, December 24, 2017 at 8:23:59 AM UTC-8, Ray Leon wrote:
>
> Hi all, 
>
> I have been working on a project for a while now and am struggling to 
> figure out a solution to tracking/logging user downloads..
>
> The download links are placed directly into the Upload_file column and 
> printed out using SQLFORM.grid , as seen below.  
>
> Upload File       Ref Letter (e.g. aa)DescriptionUpload By    Upload 
> Date               Filename         
> Download File         None                        None        Leon Grant   
>   2017-12-13 17:32:25    test_doc_2.txt
> As you can see, the table also stores the original filename. What I need 
> is to be able to return the row ID or Filename upon clicking the 
> "Download File" link. Does anybody have any ideas as to how I can 
> accomplish this given the current setup, or do I need to change the format 
> and go another route completely?
>
> Here is some of my code.. I know that grid can track the row.id as I have 
> inserted a test "link" to view the ID. I just need to be able to 
> combine the two somehow so the user can get their file and I can return 
> the file name for logging..
>

Do the sections 
at 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-uploads
and
<URL:http://web2py.com/books/default/chapter/29/09/access-control#Authorization-and-downloads>
help any?  For a field of type "upload", the default download function will 
check the authorize attribute, which can be a function; it gets passed the 
record and that can be checked for record id.
  

> [...[
>


If you roll your own upload field, the answer may not be as easy, but I 
haven't explored that.

 /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