Does anyone know how to store images or videos in Replit DB?
Optimally you would just use files, but you could base64 encode them to a string. And then put that string in the DB
There truly isn’t a right approach, but as @dragonhunter1 pointed out, the only right way is to base64-encode the image(s) and enter them into the database. Also welcome to the community @sonicx180!
If I were to use files, I need to make it so everyone can see the uploaded files(When display by the front end. I’m making a social media platform.). And how would I do this with a Flask post request? Thanks for your help!
Could you please send me a link to your repl so that I can analyze it and find a solution?
Here is a function that serves files, if this is what you are looking for. (This works with any flask request)
https://flask.palletsprojects.com/en/2.2.x/api/#flask.send_from_directory
Never mind, I was able to figure out this code myself. Thanks!
I was able to figure out this code myself. Thanks for your help!
Just a little more request, can you mark your “figured out how to fix” as solution so people like me won’t come in for help before finding out it is being solved?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.