r/web_dev • u/kamereonesec • Aug 17 '15
Store an image file in a database
I am fairly new to web development and I have a form that users fill out and everything is getting stored to a mysql db. One of the form inputs is a file upload. I want to allow users to be able to submit images.
I know that allowing users to upload files is not the best practice but it is kind of important to the goal I am trying to accomplish. I need to be able to see the image that they submit along with the rest of the information.
What is the easiest way to store files in database?
2
Upvotes
1
u/Sinjhin Aug 18 '15
Care to explain why? Using a CDN or some such and only storing the paths would be much faster, yes.
I am glad both of our answers are here, but his specs were to store them to a database. Using s3, azure, etc.. might be out of scope.
This is the first I have ever heard of using blobs to store images as being a bad thing. Just curious why you say so. Is it strictly for performance?