I see this when i return request.vars.keys() I get an empty array. That seems a little off... doesn't it? Could it be that I am missing a step with respects to reading the request object?
Thanks for your insight so far! On Aug 17, 3:18 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > This is the best way of doind it. Can you try add > > print request.vars.keys > request.body.seek(0) > > ? > > On Aug 16, 9:56 pm, Ian Reinhart Geiser <ian.gei...@gmail.com> wrote: > > > Right now im doing this but getting errors: > > @service.run > > def upload_image( camera_uuid ): > > query = (db.cameras.macaddress == camera_uuid ) > > camera_id = db(query).select(db.cameras.id)[0] > > db.videos[0]={ 'camera' : camera_id, 'file' : db.videos.file.store > > (request.body, 'upload.flv') } > > return True > > > The problem is that its generating 0 size files. But the file is > > correct, and is created in the database correctly. Did i miss a step? > > > I am using the following curl line: > > curl -T > > ~/test.flvhttp://web2py.geiseri.com/HomeCentral/default/call/run/upload_image/c... > > > I feel like im close... > > > On Aug 16, 1:55 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > Correction. This works but it probaby does not work with upload. > > > > you may need something like > > > > @auth.requires_login() > > > def uploadme(): db.mytable.insert(filefield=request.body.read()) > > > > On Aug 16, 12:50 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > if you have: > > > > > def mycreate(): return dict(form=crud.create(db.mytable)) > > > > > you normally call:http://..../mycreatetogettheform. > > > > You can also call it with > > > > >http://..../mycreate.json?json=[] > > > > > where [] is a URLencoded JSONencoded dictionary containing the new > > > > record. The ".json" instructs web2py not to generate the form but to > > > > expect a json input. This is experimental but give it try. Should > > > > work for any page including crud forms. > > > > > Massimo > > > > > On Aug 16, 10:53 am, Ian Reinhart Geiser <ian.gei...@gmail.com> wrote: > > > > > > Greetings, Currently I have a lovely web form that was fairly easy to > > > > > implement with web2py. I now also have cron script that is uploading > > > > > snapshots of an image from a webcam to my website. What I would like > > > > > to do is have a service url that I could post my image to and have it > > > > > automatically be added vs going through the form. > > > > > > From what I can tell is I would have a run REST url and i would read > > > > > the request.body object to get the file. What I am unclear on is how > > > > > I might put this on the filesystem and the needed links in the > > > > > database correctly. Do I have to roll my own update code vs using the > > > > > DAL? > > > > > > Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---