0

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?

Controller

class UserController extendes CI_Controller{
}

Model

class User extends CI_Model{
}
Will Vousden
  • 32,488
  • 9
  • 84
  • 95
Nilesh Mahajan
  • 607
  • 4
  • 16

2 Answers2

0

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

Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90
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..!

M Reza Saberi
  • 7,134
  • 9
  • 47
  • 76