On Thursday, June 2, 2016 at 12:28:54 PM UTC-7, Steven Vannoy wrote: > > I have a DAL table that contains an upload field. After a user fills in > the form and selects a file via the "Choose File" button, I want to display > the form the just filled out but not in an editable form. So I have a > controller/view pair called "view_the_form" > > In view_the_form.html I want to have a link so the user could download > that previously 'uploaded' file. I can't seem to get a valid link. > > I've been trying variations on the following: > > {{=A(T("Brochure"), _href=URL('appname','uploads',row.brochure))}} > > > Where "row.brochure" is the selected row from my db.table and brochure is > the name of the upload field. I can see that row.brochure is correct, it > contains the name of the file that is in the uploads directory. But, when I > click on that link in the browser, I get an "invalid function > (default/uploads)" message. The URL that is attempted is: > > > http://127.0.0.1:8000/uploads/sites.brochure.befaec15341b61de.6261636b67726f756e642e6a7067.jpg > > Can someone help me figure out how to provide a link to an attachment in > my db.table when viewing the table in a non-form format? > > Thanks > Steven >
I build a similar link, but send it in an email (to a support desk person). I use this (adjusted for your context) A(" (GET BROCHURE)", _href="http://oursupport.com" + URL("download", args= row.brochure)) This sends a link to the download() controller from the sample default.py (adjusted to do some logging), with the appropriate file as an argument. /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.