opening new file within controller and uploading to uploads?

20 views
Skip to first unread message

aetag...@gmail.com

unread,
May 3, 2016, 9:53:31 PM5/3/16
to web2py-users
I would like to open and write to a new file after accessing form variables passed from views...

I've been trying to find a similar problem, but not much luck ..

I suppose I can create another table with tempfile field of type uploads, and then do a database controller within the controller..

However I am wondering if there is an alternative way, where I just create the file object and send it to the uploads folder?


Thank you

Anthony

unread,
May 4, 2016, 12:08:58 AM5/4/16
to web2py-users
Check this section of the book: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads

Rather than opening an existing file, you can create a file-like object via cStringIO.

Anthony
Reply all
Reply to author
Forward
0 new messages