image not insert in mysql using codeigniter
Your form must have the multipart attribute in HTML file like below :
If you're using form helper, then it should be
<?php echo form_open_multipart('/save');?>
Else your form should have the enctype attribute like below
<form enctype="multipart/form-data">
Then the uploaded data result $this->upload->data() will come in array. So you can't store your array in mysql column. So you need to get the filename from $this->upload->data() and store it in a variable like below.
Your Controller should be
public function save(){ $this->load->model('Partner_model'); $feature = $this->input->post('feature'); $config['upload_path'] = './uploads/files'; $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('image')){ $error = array('error' => $this->upload->display_errors()); $this->load->view('partner_profile', $error); }else{ $imageArray = $this->upload->data(); $image = $imageArray['file_name']; $user_data= array( 'pname' => $this->input->post('pname'), 'type' => $this->input->post('type'), 'address' => $this->input->post('address'), 'about' => $this->input->post('about'), 'city' => $this->input->post('city'), 'code' => $this->input->post('code'), 'state'=>$this->input->post('state'), 'feature'=>implode(",",$feature), 'image' => $image ); } if($this->Partner_model->save($user_data)) { $msg = "save sucesss" ; }else { $msg = "not save"; } $this->session->set_flashdata('msg', $msg); $this->load->view('partner_profile');}