I saw the StringIO content of the blob. I had write a file manually with
that blob content... I may have not look carefully... I will have another
look.

Richard


On Sun, May 4, 2014 at 2:51 PM, Niphlod <[email protected]> wrote:

> not sure what you want to accomplish.... but....
>
>
> http://web2py.readthedocs.org/en/latest/dal.html#gluon.dal.DAL.Field.retrieve
>
> you're using nameonly, that explicitely doesn't return any content.
>
>
> On Sunday, May 4, 2014 7:58:03 PM UTC+2, Richard wrote:
>>
>> Hello,
>>
>> I try to extract file from upload field of type blob to store my files on
>> file system instead.
>>
>> I get there so far :
>>
>> rows = db().select(db.mytable.id, db.mytable.filename_field,
>> db.mytable.blob_field)
>> for i, row in enumerate(rows):
>>     if row.filename_field != '' and row.filename_field is not None:
>>         db(db.mytable.id == row.id).update(
>>             new_field_upload=db.mytable.filename_field.store(
>>                 db.mytable.filename_field.retrieve(row.filename_field,
>> nameonly=True)[1],  # Blob content, the file
>>                 db.mytable.filename_field.retrieve(row.filename_field,
>> nameonly=True)[0],  # Filename
>>                 None
>>                 ))
>>     if i % 10 == 0:
>>         db.commit()
>>
>> db.commit()
>>
>>
>> The filename get created and sotered correctly in  new_field_upload, but
>> the file from the blob content don't get write in uploads/mytable.new_field_
>> upload/HERE_IN_SUB_RANDOM_FOLDER_NAMES
>>
>> Notting get write to disk... Is .store() method not suppose to doing just
>> that?
>>
>> I will make a slice about that if I can get it to work properly.
>>
>> I was despointed this snippet wasn't there already.
>>
>> :(
>>
>> Thanks
>>
>> Richard
>>
>  --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to