Haha, works like a charm!! Thank you Massimo!

On Jul 28, 2:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> db(db.poll.id == 12).update(image
> =db.poll.image.store(request.vars.upload_file.file,request.vars.upload_file 
> .filename))
>
> On Jul 28, 6:05 am, Zhe Li <linuxcity...@gmail.com> wrote:
>
>
>
> > Hello everyone!
>
> > I am try to upload some pictures from safari on iPod, using this
> > methodhttp://www.cliqcliq.com/support/quickpic/#web-app-integration
>
> > and uploads are sent using standard POST multipart/form-data encoding.
>
> > This is my code for receiving submissions:
> > ----------------------------------------------
> > def receiveImage():
> >     if request.vars:
> >         db(db.poll.id == 12).update(image =
> > request.vars.upload_file.file.read())
> >         return XML("""
> >                     <?xml version="1.0" encoding="UTF-8"?>
> >                     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//
> > EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> >                     <plist version="1.0">
> >                     <dict>
> >                     <key>success</key>
> >                     <true/>
> >                     </dict>
> >                     </plist>
> >                     """)
> >     return False
>
> > but when i tried to check the image from admin panel it links to:
>
> >http://localhost:8001/init/appadmin/download/db/%3Copen%20file%20'%3C...
>
> > using print(request.vars.upload_file) i got:
>
> > FieldStorage('upload_file', 'quickpic.jpg', '\xff\xd8\xff
> > \xe0\x00\x10JFIF......
>
> > could you tell me how to save this file into db? thanks!!
>
> > Regards,
> > Zhe

Reply via email to