I have a model with a BinaryField storing a document (pdf, doc, etc.). It seems to be working to upload it there through a FileField, but is it even possible to show the document it in the template so users can download it?
Asked
Active
Viewed 208 times
0
-
Take a look here: https://stackoverflow.com/questions/35552590/store-matplotlib-plots-in-a-django-model-binaryfield-then-render-them-directly-f – Ahtisham Jan 22 '19 at 14:06
-
Depending on your use case, it is generally not a good idea to store uploaded files into your database. First it's very unsafe (you don't know what's in the file, it might just be an SQL injection), second it's not efficient and third it's not performant for larger files. Consider storing uploaded files to normal storage as Django media files. Then just presenting the user with a link to the file will do the trick. – dirkgroten Jan 22 '19 at 16:27