无法在数据库中插入图像文件[重复]

时间:2021-11-07 15:38:58

This question already has an answer here:

这个问题在这里已有答案:

I want to insert file in database how can i do it with codeigniter... Please note I don't want to store the path of the image. How can I store the image directly in the database?

我想在数据库中插入文件如何使用codeigniter进行...请注意我不想存储图像的路径。如何将图像直接存储在数据库中?

Controller

class UserController extendes CI_Controller{
}

Model

class User extends CI_Model{
}

2 个解决方案

#1


0  

You can store images in table with LONGBLOB datatype in mysql. just try this- http://www.phpriot.com/articles/images-in-mysql

您可以使用mysql中的LONGBLOB数据类型将图像存储在表中。试试这个 - http://www.phpriot.com/articles/images-in-mysql

#2


0  

I guess for a better speed in high range of image records, storing the path or image name in a table is much more effective than storing the image data itself. you need to store the filename or the file path as a varchar and upload the file using uoload library of codeigniter.. This makes the whole process much simpler..!

我想在高范围的图像记录中获得更好的速度,将路径或图像名称存储在表格中比存储图像数据本身更有效。你需要将文件名或文件路径存储为varchar,并使用codeigniter的uoload库上传文件。这使整个过程更加简单..!

#1


0  

You can store images in table with LONGBLOB datatype in mysql. just try this- http://www.phpriot.com/articles/images-in-mysql

您可以使用mysql中的LONGBLOB数据类型将图像存储在表中。试试这个 - http://www.phpriot.com/articles/images-in-mysql

#2


0  

I guess for a better speed in high range of image records, storing the path or image name in a table is much more effective than storing the image data itself. you need to store the filename or the file path as a varchar and upload the file using uoload library of codeigniter.. This makes the whole process much simpler..!

我想在高范围的图像记录中获得更好的速度,将路径或图像名称存储在表格中比存储图像数据本身更有效。你需要将文件名或文件路径存储为varchar,并使用codeigniter的uoload库上传文件。这使整个过程更加简单..!