file upload turbogears 2.3.1

263 views Asked by At

how to do file uploading in turbogears 2.3.1? I am using CrudRestController and tgext.datahelpers and it is uploading the file in the sqlite3 database but in an unknown format. I want to make a copy of the uploaded file in the hard drive. My query is how to ensure that when user uploads a file, it is loaded both in the database and the hard drive. (Thank you for suggestions)

1

There are 1 answers

4
amol On BEST ANSWER

tgext.datahelpers uploads files on disk inside the public/attachments directory (this can be change with tg.config['attachments_path']).

So your file is already stored on disk, only the file metadata, like the URL, filename, thumbnail_url and so on are stored on database in JSON format