I have a table with an upload field:
attachment = db.define_table('attachment',
Field('attachmentId', 'id', readable=False),
Field('name', length=50, label='Name', required=True),
Field('employeeId', db.employee, label='Employee'),
Field('ticketId', db.ticket, label='Ticket'),
Field('document', 'upload', label='Docment',
uploadfolder='//serverName/documentStore/sideboardHR/documents'
))
db.attachment.name.requires = IS_NOT_EMPTY()
I insert documents into it using:
attachmentForm = SQLFORM.factory(Field('name', length=50, label='Name',
required=True, requires=db.
attachment.name.requires),
Field('document', 'upload', label=
'Document',
required=True, requires=db.
attachment.document.requires,
uploadfolder=db.attachment.
document.uploadfolder),
_id='attachmentForm', _formname=
'attachmentForm')
if attachmentForm.process(formname='attachmentForm').accepted:
fields = attachmentForm.vars
ticket = db.ticket(ticketId)
if fields['name'] and fields['name'] != '' and fields['document']
and fields['document'] != '':
db.attachment.insert(name=fields['name'],
ticketId=ticketId,
employeeId=ticket.employeeId,
document=fields['document'])
Documents are getting there just fine. I'm using SQLFORM.grid to display
them in a list. The list creates a link for me to retrieve the file. When
I click on the link I get a 404 NOT FOUND returned to me.
Any clues? What am I missing?
-Jim
--
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/groups/opt_out.