[web2py] Re: Manual image upload

2014-02-14 Thread mannu kumar
db.mytable.insert(image=db.mytable.image.store(request.vars.image.file, request.vars.image.filename), image_blob = request.vars.image.file.read()) this should work, ref http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads << Note, if the file is to

[web2py] Re: Manual image upload

2012-05-10 Thread 王康
hi, have you guys solved this problem? Because now I'm in the same problem >_< On Sunday, December 26, 2010 4:15:54 AM UTC+8, mdipierro wrote: > > Email me your app. > > On Dec 25, 2:08 pm, "Arun K.Rajeevan" wrote: > > https://groups.google.com/d/msg/web2py/UtBmAdvY7E0/QQ5rBVM4lEIJ > > >

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
tried to upload to appspot. on admin panel, I tried to view record I just inserted. id=53018 118005 pictures.image.979a10271e1b65a7.6c7563696665722d2e6a7067.jpg 0.0 [118014L] It shows, image field is populated, but blob field is null. (thought, it may be helpful to debug )

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
It's on the way :) Thank you for your precious time.

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Email me your app. On Dec 25, 2:08 pm, "Arun K.Rajeevan" wrote: > https://groups.google.com/d/msg/web2py/UtBmAdvY7E0/QQ5rBVM4lEIJ > > tables are given in that post. > > But, as I point out last, problem may be in conversion of file into blob and > getting it back. > BTW, if you can suggest a solu

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
https://groups.google.com/d/msg/web2py/UtBmAdvY7E0/QQ5rBVM4lEIJ tables are given in that post. But, as I point out last, problem may be in conversion of file into blob and getting it back. BTW, if you can suggest a solution discussed in above link that will be great; although this problem is am

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Arun, we cannot continue like this. I need to see the entire model and actions that do upload/download. Perhaps something is wrong with web2py but you are not providing a way to reproduce the problem. Massimo On Dec 25, 1:59 pm, "Arun K.Rajeevan" wrote: > I changed >  image = > db.pictures.imag

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
I changed image = db.pictures.image.store(form.vars.image.file, form.vars.image.filename) to image = db.pictures.image.store(request.vars.image.file) for above post. Now I changed them back. (ie correct thing) Now there's no error in console. But image is not showing up. And I tried to

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Arun, did you read this? On Dec 25, 1:18 pm, mdipierro wrote: > Actually... this is correct > >   image = db.pictures.image.store(form.vars.image.file, > form.vars.image.filename) > > this is not correct (my mistake) > >   image = db.pictures.image.store(request.vars.image.file) > > but this is c

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
Updated from trunk. run again. Still GAE shows error. Now page is not rendering at all. (before page showed without image) ERROR2010-12-26 06:08:42,649 restricted.py:151] Traceback (most recent call last): File "/media/KRA/Evolve/Work/web2py_src_downloaded/google_appengine/Test/gluon/rest

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Actually... this is correct image = db.pictures.image.store(form.vars.image.file, form.vars.image.filename) this is not correct (my mistake) image = db.pictures.image.store(request.vars.image.file) but this is correct again because the file object carries a filename image = db.pictures.i

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
I'm going to check trunk, but I'm curious to know the difference b/n image = db.pictures.image.store(form.vars.image.file, form.vars.image.filename) and image = db.pictures.image.store(request.vars.image.file) first one has two arguments and later has only one.( so, file name is not mandatory?)

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Please show he entire action. On Dec 25, 1:11 pm, "Arun K.Rajeevan" wrote: > This worked with web2py alone, but through GAE following error occured > > ERROR    2010-12-26 05:35:43,554 restricted.py:151] Traceback (most recent > call last): >   File > "/media/KRA/Evolve/Work/web2py_src_downloaded

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
This worked with web2py alone, but through GAE following error occured ERROR2010-12-26 05:35:43,554 restricted.py:151] Traceback (most recent call last): File "/media/KRA/Evolve/Work/web2py_src_downloaded/google_appengine/visuallingua/gluon/restricted.py", line 188, in restricted exe

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
I understand now. I think the problem is that the field was added later and there are record that contain None instead of ''. I fixed this in trunk, please check it. massimo On Dec 25, 1:02 pm, "Arun K.Rajeevan" wrote: > As I said, Insert seems working. since, form.accepts work. > Error occurs,

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
As I said, Insert seems working. since, form.accepts work. Error occurs, when I'm trying to retrieve it. url = URL(r=request, f='download', args=[item.image]) IMG(_src=url, _width='150px', _height='125px') this is how I shows picture on page. When run through GAE it doesn't shows picture. (it w

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
this: id = db.pictures.insert(image = db.pictures.image.store(request.vars.image),words=[id], entry_by=who) should be id = db.pictures.insert(image = db.pictures.image.store(request.vars.image.file),words=[id], entry_by=who) On Dec 25, 12:00 pm, "Arun K.Rajeevan" wrote: > db.mytable.insert(ima

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
So it works now? On Dec 25, 12:35 pm, "Arun K.Rajeevan" wrote: > Oh, silly me. > It took me some time to go through dal.py and realize I made a mistake by > running above commands in web2py shell. > > There db.adapter will be SQLite and I've problem with gae. > > Now, here is the actual result. >

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
Oh, silly me. It took me some time to go through dal.py and realize I made a mistake by running above commands in web2py shell. There db.adapter will be SQLite and I've problem with gae. Now, here is the actual result. print db.pictures.fields() * ['id', 'image', 'words', 'rating', 'entry_by',

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
web2py Shell Version 1.91.4 (2010-12-24 10:54:48)In[0]: print db.pictures.fields() Out[0]: ['id', 'image', 'words', 'rating', 'entry_by'] In[1]: print db.pictures.image.uploadfield Out[1]: True In[2]: print db._adapter.uploads_in_blob Out[2]: False

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
Strange. Can you plese print db.pictures.fields() print db.pictures.image.uploadfield print db._adapter.uploads_in_blob what's the output? In gluon/dal.py there is this line: if db and self._db._adapter.uploads_in_blob==True or for field in fields: if isins

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
db.mytable.insert(image=db.mytable.image.store(request.vars.image)) will not work - Traceback (most recent call last): File "/media/KRA/Evolve/Work/web2py

[web2py] Re: Manual image upload

2010-12-25 Thread Arun K.Rajeevan
restlessly trying again and again db.pictures.insert(image = db.pictures.image.store(form.vars.image.file, form.vars.image.filename) worked fine while I'm running web2py stand alone. But as soon as I try to run it through GAE, it cause error. INSERT seems working, except, file is stored some un

[web2py] Re: Manual image upload

2010-12-25 Thread mdipierro
If you make a form with FROM(...INPUT()) the form has not knowledge of DB and form.accepts will not perform any db-io BUT you can do form=FORM(INPUT(_name='image',_id='image', _type='file'),...) if form.accepts(): db.mytable.insert(image=db.mytable.image.store(request.vars.image)) On