图像未在localhost中上传

时间:2018-04-29 08:37:38

标签: image http upload localhost

我在我的项目中上传了两张图片。在线图片上传没有问题。但是当我在localhost中尝试显示"此页面无法正常工作localhost目前无法处理此请求。 HTTP ERROR 500"。什么可以解决方案请帮助我们提前感谢。这是我的代码。

       if (!empty($_FILES['userfile']['name'])) {
        $config['upload_path']   = './uploads/customer';
        $config['allowed_types'] = 'jpg|jpeg|png|gif';
        $config['file_name']     = time() . $_FILES['userfile']['name'];

        //Load upload library and initialize configuration
        $this->load->library('upload', $config);
        $this->upload->initialize($config);

        if ($this->upload->do_upload('userfile')) {
            $uploadData        = $this->upload->data();
            $data['CustPhoto'] = $uploadData['file_name'];
        } else {
            echo "filenot upload";
        }
    } else {
        $data['message'] = "Please select Your Photo ";
        $this->session->set_userdata($data);
        redirect('Sr_user/customer_manage');
    }

    if (!empty($_FILES['userfile1']['name'])) {
        $config['upload_path']   = './uploads/customer';
        $config['allowed_types'] = 'jpg|jpeg|png|gif';
        $config['file_name']     = time() . $_FILES['userfile1']['name'];

        //Load upload library and initialize configuration
        //$this->load->library('upload', $config);
        $this->upload->initialize($config);

        if ($this->upload->do_upload('userfile1')) {
            $uploadData              = $this->upload->data();
            $data['NationalIdPhoto'] = $uploadData['file_name'];

        } else {
            echo "filenot upload";
        }
    } else {
        $data['message'] = "Please select Your National Id Image ";
        $this->session->set_userdata($data);

       redirect('Sr_user/customer_manage');
    }

    $this->Super_admin_model->add_action($data, 'member_manage');

0 个答案:

没有答案