How to upload an image into database?
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?
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.
This topic is now closed. New replies are no longer allowed.