Hi M -

So I've used you example (a little simplified):

On Jun 23, 3:15 am, Swell <swel...@googlemail.com> wrote:
> Ok
> I will post some code here to show as much as possible
>
> here is the db definition:
>
> db.define_table('papers',
>   Field('title','string'),
>   Field('author','string'),
>   Field('file','upload'),
>   )

I used this table for test model (note:  string is default):

db.define_table( 'test',
                 Field( 'name' ),
                 Field( 'author'),
                 Field( 'note' ),
                 Field( 'file', 'upload'),
               )

I used this for the controller:

def test():
    form=SQLFORM(db.test)
    if form.accepts( request.vars, session ):
        session.flash = 'this works'
        redirect(URL(r=request, f='index'))
    elif form.errors:
        response.flash = 'form has errors'
    return dict(form=form)

I copied your filename  (well - actually, I changed the extension to
jpg - since I made a copy of a file I could see),

And uploaded it thru the form;   I set a breakpoint after form.accepts
to confirm that the long name and path were properly formed (they
were);

I then went in through database admin, looked (again) at the long file
name, copied to link to it to make sure it was what I expected to see
(it got awfully long!!!!) - it was there, and I was able to download
and view it from the db admin link.

I then also added another record with the same file  --- and
(appropriately) there are two files in the app upload directory, and I
can download each.

I tested this on mac;   I expect this would also work on linux;

Someone will have to see if there is an issue w/ PC's,  but for now -
I am not able to reproduce your issue.

Regards,
- Yarko
>
> then if i try to use the database administration tool available in
> Models section and try to insert a file like
> "The Pricing of Options and Corporate Liabilities_Journal of Political
> Economy.pdf" i then get a ticket complaining about
>
> IOError: [Errno 2] No such file or directory:
> C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/
> databases\\..\\uploads\
> \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf'
>
> i also checked the file actually has never been properly uploaded ( it
> is not present in the upload directory). Nothing special about size of
> the file ( if i just  change manually the filename it works ). So it
> seems that the bug is when we receiving the file .
>
> hope we can sort this out
> Thx all
> M

Reply via email to