Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法使用CodeIgniter上载文件_Php_Codeigniter_File Upload - Fatal编程技术网

Php 无法使用CodeIgniter上载文件

Php 无法使用CodeIgniter上载文件,php,codeigniter,file-upload,Php,Codeigniter,File Upload,我正在尝试CI的文件上载类,并从中获取了引用。这是控制器的代码 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Upload extends CI_Controller { public function __construct() { parent::__construct(); $this->load->he

我正在尝试CI的文件上载类,并从中获取了引用。这是控制器的代码

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Upload extends CI_Controller {

    public function __construct()
    {
        parent::__construct();

        $this->load->helper(array('form', 'url'));
    }

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

    public function do_upload()
    {
        $config['upload_path']          = './uploads/';
        $config['allowed_types']        = 'gif|jpg|png|pdf|docx';
        $config['max_size']             = 2048000;
        $config['max_width']            = 1024;
        $config['max_height']           = 768;

        $this->load->library('upload', $config);

        if ( ! $this->upload->do_upload('userfile'))
        {
            $error = array('error' => $this->upload->display_errors());

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

            $this->load->view('admin/upload_success', $data);
        }
    }
}
?>

我不知道为什么错误消息显示我的上传。我没有在控制器或视图中的任何位置使用过它。您能告诉我这个控制器的名称吗?Upload是默认的关键字。
 An uncaught Exception was encountered
Type: Error

Message: Call to undefined method my_upload::do_upload()

Filename: C:\xampp\htdocs\dd\dd\app\controllers\Upload.php

Line Number: 27

Backtrace:

File: C:\xampp\htdocs\dd\dd\dd\index.php
Line: 241
Function: require_once