上传类codeigniter不工作,并没有输入到数据库

问题描述:

嗨,大家好,我有上传类codeigniter的问题..上传不工作,没有输入到数据库..我认为在功能,如果不工作,但如何?在我的其他代码我通常使用这个代码总是工作..上传类codeigniter不工作,并没有输入到数据库

这个功能我觉得不行

if ($this->upload->do_upload('cv')) { 
    $data = $this->upload->data(); 
    $cv = $this->createImageOne($data); 
} 

if ($this->form_validation->run() === TRUE) { 

     $nik = $this->input->post('nik', true); 
     $employee_name = trim(addslashes($this->input->post('employee_name', true))); 
     $email = trim(addslashes($this->input->post('email', true))); 
     $sex = trim(addslashes($this->input->post('sex', true))); 
     $bornplace = trim(addslashes($this->input->post('bornplace', true))); 
     $borndate = trim(date('Y-m-d', strtotime($this->input->post('borndate', true)))); 
     $address = trim(addslashes($this->input->post('address', true))); 
     $tlp = trim(addslashes($this->input->post('tlp', true))); 
     $education = trim(addslashes($this->input->post('education', true))); 
     $position = trim(addslashes($this->input->post('position', true))); 
     $vendor = trim(addslashes($this->input->post('vendor', true))); 
     $gapok = trim(addslashes($this->input->post('gapok', true))); 
     $start_date = trim(date('Y-m-d', strtotime($this->input->post('start_date', true)))); 
     $end_date = trim(date('Y-m-d', strtotime($this->input->post('end_date', true)))); 
     $status = trim(addslashes($this->input->post('status', true))); 

     $this->load->library('image_lib'); 
     $config['upload_path'] = $this->config->item('upload_temp'); 

     $config['allowed_types'] = '*'; 
     $config['max_size'] = '1000000'; 
     $config['max_width'] = '2048'; 
     $config['max_height'] = '2048'; 

     $this->load->library('upload', $config); 


     $cv = ''; 
     $foto = ''; 



     if ($this->upload->do_upload('cv')) { 
      $data = $this->upload->data(); 
      $cv = $this->createImageOne($data); 
     } 



     if ($this->upload->do_upload('foto')) { 
      $datafour = $this->upload->data(); 
      $foto = $this->createImageFour($datafour); 
     } 

     $this->Mkaryawan->insert_karyawan($nik, $employee_name, $email, $sex, $bornplace, $borndate, $address, $tlp, $education, $position, $vendor, $gapok, $start_date, $end_date, $status, $cv, $foto); 


    } 

您可以删除下面的代码行。至于如果文件上传的作品完美,那么你可以将更多的验证:

$this->load->library('image_lib');

$config['max_size'] = '1000000'; $config['max_width'] = '2048'; $config['max_height'] = '2048';

作为参考,你可以按照this link在笨上传单/多文件

+0

我不吨得到它形式的链接,也许是真的我的代码不能工作因为数据库?由于数据库而导致 –

+0

?我没有明白你的观点。 – user2005235