Just found something else interesting about this:
I created one document using a test controller I'd created with a simple
SQLFORM.grid in it. That one I can retrieve. There are 2 documents that
were created with the SQLFORM.factory as detailed below, and they don't
work.
The one that was created with SQLFORM.grid is named:
attachment.document.ac4eaf2513b348f0.6469737472696275746f725265626174652e706466.pdf
The 2 created with SQLFORM.factory are:
no_table.document.abdf7e081804a484.6469737472696275746f725265626174652e706466.pdf
no_table.document.bc7c124a9de673f3.62617365646f632e706466.pdf
Not sure why the good one is prefixed with attachment and the other two say
no_table.
Any ideas?
-Jim
On Thursday, November 7, 2013 3:32:09 PM UTC-6, Jim S wrote:
>
> 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.