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

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


CodeIgniter's file uploading class will do this for you. The entry in their user guide explains as well as I could, so I'm going to point you there.

Essentially you'd just need to modify the controller that they have there to include a bit where you put the file URL in the database, which you can accomplish easily by using $this->upload->data() and extracting [full_path] from the resulting array, and then sending it to a model which handles the database input.


use form_open_multipart() not form_open()


use the model pages to upload data to database