Hi,

I have a table with texts and uploaded files, something like


db.define_table('mails',
    Field('description'),
    Field('attach','upload'),
    Field('receiver')
)


and a function to send record 1 as an email:

def mymail():
    r=db.mails(1)
    file=URL('download', args=r.attach)
    mail.send(r.receiver, r.description, attachments=Mail.Attachment(file))



I got:

<type 'exceptions.IOError'> [Errno 2] No such file or directory:
'/myapp/default/download/mails.attach.8f17405ced65b662.66617669636f6e2833292e69636f.ico'

and that is the content of the variable "file".

I think, I have not understood the upload function. I have read about it in
the book and tried to write my function like these examples  - but without
success.

A workaroung is a line like.

    file=request.folder+'\\uploads\\'+r.attach


It does the job - but is it a good programming style?

Any hints?
Regards, Martin

-- 



Reply via email to