Halfway there! Using the above controller, I am now able to upload
files. On the client side the thing that saved me was the 'poster'
urrlib2-based utility available at http://pypi.python.org/pypi/poster
(with a couple of small modifications).

Thank you, pbreit.


On Apr 28, 11:17 am, dhmorgan <[email protected]> wrote:
> Thanks for the leads; I just watched the restful api's video and have
> been reading up on doing this with xmlrpc.
>
> In the meantime, based on your first comment, here is a controller
> that does work, at least through the browswer:
>
> ----------------
> def add_photo():
>     form = SQLFORM(db.photolog)
>     if request.post_vars:
>         db.photolog.insert(title=request.vars.title,
>             photo=db.photolog.photo.store(request.vars.photo,
>
> request.vars.photo.filename),
>             photo_data=request.vars.photo.file.read())
>     return dict(form=form)
> ----------------
>
> On Apr 27, 4:38 pm, pbreit <[email protected]> wrote:
>
> > I don't think you can suppress the formkey check so all I can think of is
> > skipping the "if form.accepts" and processing everything yourself.
>
> > You also might want to have a look at XMLRPC which is sort of designed for
> > this kind of thing:http://web2py.com/book/default/chapter/09#XMLRPC
>
> > The new REST capabilities might work as well but I couldn't find detail on
> > POSTing into 
> > them:https://groups.google.com/d/topic/web2py/gcqEcXIo7RI/discussion
>
>

Reply via email to