im trying to upload an image with a title and description along with the image upload. My image upload and text inputs work separately and the text and the image path is also inserted to the DB but i still cant figure how to combine both
i used the guides given in http://codeigniter.com/user_guide/libraries/file_uploading.html
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
can someone tell me how can i insert some text fields along with the image upload form to a sql database?
Basically, just put the image upload input in the same form, like:
And add in the controller the POST reading:
You will also need to make a proper model to input the data in the database.