简体   繁体   中英

Store Images in MySQL Database

I want to know how to store images and files in a MySQL Database.

I want to get images and files like that www.example/rsrc.php/example-image.jpg

example on Facebook: facebook-example.com/rsrc.php/v2/yw/r/svhh826BLKd.png

Create a BLOB column in database table,

probably mediumblob.

but it is good to keep the photo in directory and keep the path in the database. Cheers

 CREATE TABLE tblname(ID INT,IMAGE BLOB);

INSERT INTO tblname(ID,IMAGE) VALUES(1,LOAD_FILE('C:/test.txt'));

added the answer from the comments to this question in the answer box..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM