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 be stored in an associated blob field rather than 
the file system, the store() method will not insert the file in the blob 
field (because store() is called before the insert), so the file must be 
explicitly inserted into the blob field:

>>> db.define_table('myfile',
        Field('image', 'upload', uploadfield='image_file'),
        Field('image_file', 'blob'))
>>> stream = open(filename, 'rb')
>>> db.myfile.insert(image=db.myfile.image.store(stream, filename),
        image_file=stream.read())

>>



On Friday, 11 May 2012 01:49:00 UTC+5:30, 王康 wrote:
>
> 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" <the1.a...@gmail.com> 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 solution discussed in above link that will be 
>> > great; although this problem is amusing, I'm in need for a solution.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to