CodeIgniter 上传错误不显示

CodeIgniter Upload Errors Not Showing

几天前我一直在关注 CodeIgniter 文件上传教程 here

在完成教程时,上传字段工作正常,显示无效文件路径、类型和尺寸的错误。

但现在它只显示无效文件路径错误,但不显示文件类型或尺寸。尝试上传无效的文件类型或尺寸时,上传字段变为空白,没有任何错误消息。

这是我的代码:

上传控制器

<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Upload extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper("form");
        $this->load->helper("url");
    }

    public function index()
    {
        $this->load->view("templates/index");
    }

    public function upload_form()
    {
        $this->load->library("upload_helper");
        $config = $this->upload_helper->upload_config("./static_repo/uploads/", "gif|jpg|png", 100, 1024, 768);
        $this->load->library("upload", $config);

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

            $this->load->view("upload/upload_form_page", $data);
        }
        else
        {
            $data = array(
                "upload_data" => $this->upload->data()
            );

            $this->load->view("upload/upload_success_page", $data);
        }
    }
} //end class Upload

HTML表格

<?= $error ?>

<form enctype="multipart/form-data" method="post">
    <input type="file" name="userfile" size="20">
    <br/><br/>
    <input class="btn btn-default" type="submit" value="upload"/>
</form>

我已经解决了

必须在我的本地 wamp 服务器上修改 post_max_size php.ini。