Php codeigniter图像上载错误

Php codeigniter图像上载错误,php,codeigniter-2,Php,Codeigniter 2,使用上述方法上载图像时,会出现以下错误 致命错误:未捕获错误:在C:\xampp\htdocs\Project\application\controllers\jobseker\u profile.php:53堆栈跟踪:0 C:\xampp\htdocs\Project\system\core\CodeIgniter.php360:jobseker\u profile->getbasicinfo 1 C:\xampp\htdocs\Project\index.php202:require\u o

使用上述方法上载图像时,会出现以下错误

致命错误:未捕获错误:在C:\xampp\htdocs\Project\application\controllers\jobseker\u profile.php:53堆栈跟踪:0 C:\xampp\htdocs\Project\system\core\CodeIgniter.php360:jobseker\u profile->getbasicinfo 1 C:\xampp\htdocs\Project\index.php202:require\u once'C:\xampp\htdocs…'2{main}在第53行的C:\xampp\htdocs\Project\application\controllers\jobseker\u profile.php中抛出

您缺少do_upload函数定义,此处修复了代码

下面是HTML示例代码

public function getbasicinfo()
{
    if($this->form_validation->run('basicinfo')==TRUE) {
      $data=$this->input->post();

       $config = [
                'upload_path'   => 'assets/img/jobseeker',
                'allowed_types' => 'gif|jpg|png',
                'max_size'      => '10000',
                'max_width'     => '1024',
                'max_height'    => '768',
                'overwrite'     =>  TRUE,
               'encrypt_name'  =>  FALSE,
                'remove_spaces' =>  TRUE
        ];

        if ( ! is_dir($config['upload_path']) ) die("THE UPLOAD DIRECTORY DOES NOT EXIST");
        $this->load->library('upload', $config);

        if(! $this->upload->do_upload('image'))
        {
            $error = $this->upload->display_errors();
            $this->session->set_flashdata('image',$error);
                redirect('Jobseeker_profile/editbasicinfo');
        }
        $img = $this->upload->data();
        $data['image']=$img['file_name'].$id;
        $this->load->model('jobseeker_profilemodel','profile');              
        $query=$this->profile->basicinfo($data);
        if ($query==TRUE) {
            redirect('jobseeker/jobpreference');
        }

    }else{
        $this->load->view('jobseeker/editBasicInfoMyProfile');
   }    
}
下面是do_upload函数示例类的结构,我认为这将帮助您理解do_upload函数的定义

 function do_upload()
    {
        $config['upload_path'] = './uploads/';
        $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())
        {
            $error = array('error' => $this->upload->display_errors());

            $this->load->view('upload_form', $error);
        }
        else
        {
            $data = array('upload_data' => $this->upload->data());

            $this->load->view('upload_success', $data);
        }
    }
您在哪里定义do_上传功能?
 function do_upload()
    {
        $config['upload_path'] = './uploads/';
        $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())
        {
            $error = array('error' => $this->upload->display_errors());

            $this->load->view('upload_form', $error);
        }
        else
        {
            $data = array('upload_data' => $this->upload->data());

            $this->load->view('upload_success', $data);
        }
    }
class Upload extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
    }

    function index()
    {
        $this->load->view('upload_form', array('error' => ' ' ));
    }