大家好我上传类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);
}
答案 0 :(得分:0)
您可以删除以下代码行。好像文件上传工作完美,那么您可以应用更多验证:
$this->load->library('image_lib');
$config['max_size'] = '1000000';
$config['max_width'] = '2048';
$config['max_height'] = '2048';
作为参考,您可以按照How to Run Performance Tests on OAuth Secured Apps with JMeter上传CodeIgniter中的单个/多个文件