Can we access a image from database without the image in any folder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we access a image from database without the image in any folder

27th Mar 2017, 3:33 PM
sanaka kavitha
sanaka kavitha - avatar
2 Answers
+ 2
Yes, you can store images in a database as a blob as far as I know. Not recommended for a large database of photos. Hope this helps Edit: based on your second question how to insert it into the database there's basically two ways, but what you probably want is the following: INSERT INTO MY_TABLE(id, blob_col) VALUES(1, LOAD_FILE('/full/path/to/file/myfile.png') That's based on what I found here: http://stackoverflow.com/a/18082149/4103154 Or if running from PHP you could implement the following somehow: $sql = "INSERT INTO MY_TABLE(id,blob_col) VALUES(1,'" . file_get_contents('/full/path/to/file/myfile.png') . "')" Based on this answer: http://stackoverflow.com/a/7052685/4103154 If you run into any problems let me know.
29th Mar 2017, 4:24 AM
Jeromy Reimer
Jeromy Reimer - avatar
0
How can we insert it in database
29th Mar 2017, 3:55 AM
sanaka kavitha
sanaka kavitha - avatar