### Here is the model

db.define_table('photo',
              db.Field('photoname', type='string',length=20),
              db.Field('photodesc', type='string',length=250),
              db.Field('photoviewprv', type='boolean',default=False),
              db.Field('photocreattime', type='datetime',default=now),
              db.Field('photomodtime', type='datetime',default=now),
              db.Field('photoactif', type='boolean',default=True),
              db.Field('physicallink', type='string',length=200,
requires = IS_NOT_EMPTY()), #2 b review#
              db.Field('fileupload', type='upload', requires =
IS_NOT_EMPTY()),
              db.Field('albphotoref_fk',db.album, requires = IS_IN_DB
(db,db.album.id), ondelete = 'CASCADE'),
              migrate=True))


### Here is the controller

from gluon.sqlhtml import form_factory

    albumNameList = [y.id for y in db(db.album.buacct_fk ==
session.auth.user.id).select(db.album.id)]

    list =db(db.album.buacct_fk == session.auth.user.id).select
(db.album.id)

    db.photo.photoname.label='Photo'
    db.photo.fileupload.label='Upload'
    db.photo.albphotoref_fk.label='Album Name'

    db.photo.albphotoref_fk.requires = IS_IN_SET(albumNameList)

    db.photo.albphotoref_fk.requires = IS_IN_DB(db(db.album.buacct_fk
== auth.user.id), "album.id", "%(albumname)s")

    formPic = form_factory(db.photo, fields=
['photoname','fileupload','albphotoref_fk'])

    if formPic.accepts( request.vars, session,
                       formname='formPic',keepvalues=True):

       feedback = db.photo.insert(fileupload=request.vars.fileupload,
photoname= request.vars.photoname, albphotoref_fk=
request.vars.albphotoref_fk)

    elif formPic.errors: response.flash = 'Problem Uploading please
try again'

    return dict(formUploadPic = formPic)



Thanks,
Yannick P.

On Oct 6, 9:40 pm, mdipierro <[email protected]> wrote:
> Can you show us the model and the action that does the upload?
>
> On Oct 6, 7:03 pm, Yannick <[email protected]> wrote:
>
> > Hello mate,
> > When uploading a JPG photo from my application I have an error message
> > referring to the encoding... here is the error coming from sql.py:
>
> > "
> > DataError: invalid byte sequence for encoding "UTF8": 0xff
> > HINT:  This error can also happen if the byte sequence does not match
> > the encoding expected by the server, which is controlled by
> > "client_encoding".
> > "
>
> > I'm migrating from MySQL to PostgreSQL... I never had that issue with
> > MySQL before...
>
> > Any hints ?
>
> > Thanks,
> > Yannick P.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to