On Tuesday, April 3, 2018 at 4:45:43 AM UTC-7, Anthony wrote:
>
> On Tuesday, April 3, 2018 at 6:09:36 AM UTC-4, Dave S wrote:
>>
>> On Monday, April 2, 2018 at 12:50:38 PM UTC-7, Diego Tostes wrote:
>>>
>>> Hi,
>>>
>>> I already use this:
>>>
>>> stream = open("<path>/teste_en.pdf", 'rb')
>>>     db.ensaios.insert(codigo_registro="novo ensaio",
>>>                       en_pdf=stream             
>>>         )
>>>
>>>
>> You're using this to read the file into the uploads table?  You haven't 
>> set "uploadfield=True" on your upload fields, so the model is expecting the 
>> file to be stored in the uploads directory, and a filename to be filled in 
>> as the field value.
>>
>
> The above is correct -- you can pass a stream directly to .insert() and 
> the DAL will store the file in the filesystem and the (transformed) 
> filename in the database field. See 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads
> .
>
> Anthony
>

I've read that section before, so it's strange that I don't recognize that 
part.  Maybe I'll learn it the second^Wthird time around.
 

/dps

-- 
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/d/optout.

Reply via email to