如何在包含其他输入字段的表单中使用编码编写器上传文件


how to upload a file using codeigniter in a form containing other input fields also in codeigniter

我一直在尝试上传一个包含其他输入字段的表单文件,虽然其他字段已成功添加到数据库,但文件未被上传到定义的路径。有谁能帮我举个小例子吗

控制器:-seller_module

代码:

public function get_seller_details()
{
 $business_name = $this->input->post("business_name");
 $business_address = $this->input->post("business_address");
 $pin_code = $this->input->post("pin_code");
 $city = $this->input->post("city");
 $state = $this->input->post("state");
 $pan = $this->input->post("pan");
 $upload_pan = $this->input->post("upload_pan");
 if($upload_pan == "UPLOADPAN")
{
 $this->load->helper('form');
 $config['upload_path'] = 'application/views/uploads/pan';
 $config['allowed_types'] = 'gif|jpg|png';
 $this->load->library('upload', $config);
 $this->upload->initialize($config);
 $this->upload->set_allowed_types('*');
 if (!$this->upload->do_upload('pan_proof')) {
 $data['msg'] = $this->upload->display_errors();
 }
 else { 
 $data['msg'] = "Upload Success!";
 }
 $this->load->view('seller_details', $data);
 }
 $this->form_validation->set_rules('business_name', 'Business Name', 'required');
 $this->form_validation->set_rules('business_address', 'Business Address', 'required');
 if($this->form_validation->run() == FALSE)
 {   
 $this->load->view('seller_details');
 }
 else
 {      
 $this->seller_model->get_seller_details($business_name,    $business_address, $pin_code, $city, $state, $pan);
 $this->load->view('success');
 }
}

问题正在解决,这是UPLOADPAN按钮,我删除了按钮,文件成功上传