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.

Reply via email to