image not insert in mysql using codeigniter

ساخت وبلاگ
چکیده : I am trying to insert images in mysql database with other data but its shows error. its shows the $m... با عنوان : image not insert in mysql using codeigniter بخوانید :

I am trying to insert images in mysql database with other data but its shows error. its shows the $msg of not saved & repeat data of view file maybe due to $error which i set. PS: I set 'image' datatype varchar in database. here is my view file:

        <input type="file" class="form-control-file" name="image" id="exampleInputFile" >

this is my controller:

 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
{


  $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'),
//  'image'=>$this->upload->do_upload('image')
  'feature'=>implode(",",$feature),
   'image' => $this->upload->data()

    );  
   }

    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');
 }
}

& this is my model:

    public function save($data)
  {

   return $this->db->insert('property', $data);

  }
back soft...
ما را در سایت back soft دنبال می کنید

نویسنده : استخدام کار بازدید : 6 تاريخ : دوشنبه 3 دی 1397 ساعت: 8:25