How to upload an image into db?

How to upload an image into database?
:frowning:

If you use advanced search > Titles only and search for ā€œphoto databaseā€ there are 140 results.

Also you could do with suppling more information like are you putting the path into the database or the image; are you resizing etc. as well; are you using a form and if so how many images at once?

Another search
https://www.google.com/search?q=php+images+into+mysql

However, long story short: you need a [blob] field, add into it a base64_encode of file_get_contents( image ) and for display, use header(ā€˜Content-type: image/jpgā€™); (or whatever)

Or even better, do NOT store images in the database. Store them on disk, and put only image file name in the database. Unless you have a homework or something like that where you need to practice such thingsā€¦

True, this is a bad practice for so many reasons - first two, if you need examples: scalability and performance.

you can upload in to directory and save the path in a field and then fetch data display it.