CodeIgniter:在数据库中存储图像?

时间:2010-05-05 17:06:21

标签: mysql image codeigniter

我想使用CodeIgniter PHP框架将图像存储在mySQL数据库中。 如何编写和阅读图像?

谢谢。

2 个答案:

答案 0 :(得分:4)

您必须使用CI的文件上传类来上传文件并使用模型将它们保存到数据库中,以下是相关资源:

<强> File Uploading Class
Models

答案 1 :(得分:3)

将实际图像文件直接存储在数据库中被认为是不好的做法。相反,您只需在数据库中存储文件的路径,并将文件存储在服务器上的目录中。

AstaHost Forums

Best approach for storing uploaded image

CodeIgniter - Uploading an Image through a form, store the location of the image in database