[英]Store Images in MySQL Database
I want to know how to store images and files in a MySQL Database.我想知道如何在 MySQL 数据库中存储图像和文件。
I want to get images and files like that www.example/rsrc.php/example-image.jpg
我想获得像
www.example/rsrc.php/example-image.jpg
这样的图像和文件
example on Facebook: facebook-example.com/rsrc.php/v2/yw/r/svhh826BLKd.png Facebook 上的示例:facebook-example.com/rsrc.php/v2/yw/r/svhh826BLKd.png
Create a BLOB column in database table,在数据库表中创建一个 BLOB 列,
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..在答案框中添加了对该问题的评论中的答案..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.