我一直在尝试使用包含其他输入字段的表单上传文件,虽然其他字段已成功添加到数据库,但文件未上传到定义的路径。 任何人都可以帮助一个小例子
控制器:-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');
}
}
答案 0 :(得分:0)
问题正在解决,它是UPLOADPAN按钮,我删除按钮并且文件已成功上传