Question

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)

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top