Hello,
I have two tables with 'file upload' fields. One is populated from a
form generated with SQLFORM, and the other with SQLFORM.factory.
The file uploads in the table populated by the SQLFORM.factory form
cannot be downloaded, not even in appadmin, which generates hyperlinks
like the one below:
<a href="/HubForms/appadmin/download/db/
no_table.Attachment.a2a08ab9ddf454ec.
47757275204e616e616b2036303831382e706466.pdf">file</a>
The error I get is:
Traceback (most recent call last):
File "C:\Program Files\Hub Pages\web2py\gluon\restricted.py", line
178, in restricted
exec ccode in environment
File "C:/Program Files/Hub Pages/web2py/applications/HubForms/
controllers/appadmin.py", line 410, in <module>
File "C:\Program Files\Hub Pages\web2py\gluon\globals.py", line 96,
in <lambda>
self._caller = lambda f: f()
File "C:/Program Files/Hub Pages/web2py/applications/HubForms/
controllers/appadmin.py", line 138, in download
return response.download(request,db)
File "C:\Program Files\Hub Pages\web2py\gluon\globals.py", line 194,
in download
field = db[t][f]
File "C:\Program Files\Hub Pages\web2py\gluon\sql.py", line 1323, in
__getitem__
return dict.__getitem__(self, str(key))
KeyError: 'no_table'
It's the "no_table" part which makes any attempt to download the file
fail, although the file is also called
"no_table.Attachment.a2a08ab9ddf454ec.
47757275204e616e616b2036303831382e706466.pdf"
The table is generated with:
form = SQLFORM.factory(db.CAR_Report, fields=FieldsToDisplay,
name=db.CAR_Report)
So the question is, how do I make SQLFORM.factory upload files storing
the correct table name?