使用 CI 创建多文件上传表单


Creating a multiple file upload form with CI

希望有人可以帮助我。

我正在开发一个表单,该表单允许使用 CodeIgniter 和 jQuery 上传多个文件,以使用一个上传字段启用多个文件上传。

但是现在我在火虫中得到以下错误:

未声明 HTML 文档的字符编码。如果文档包含 US-ASCII 范围之外的字符,则文档在某些浏览器配置中将以乱码文本呈现。必须在文档或传输协议中声明页面的字符编码。

这意味着HTML文档没有被清除,但我不明白出了什么问题。

我有以下控制器:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upload extends CI_Controller {

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

    public function index(){
        $this->load->view('includes/header');
        $this->load->view('upload');
        $this->load->view('includes/footer');
    }
    function do_upload()
    {
        $config['upload_path'] = './uploads/'; // server directory
        $config['allowed_types'] = 'gif|jpg|png'; // by extension, will check for whether it is an image
        $config['max_size']    = '1000'; // in kb
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        $this->load->library('upload', $config);
        $this->load->library('Multi_upload');
        $files = $this->multi_upload->go_upload();
        if ( ! $files )        
        {
            $error = array('error' => $this->upload->display_errors());
            $this->load->view('upload_form', $error);
        }    
        else
        {
            $data = array('upload_data' => $files);
            $this->load->view('upload_success', $data);
        }
    }
}

所以我的第一个想法是我没有清除标题中的元标记,但事实并非如此:

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" > 
<link href="<?=base_url();?>src/css/style.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="<?=base_url();?>src/js/jquery.MultiFile.js"></script>    
</head>

如果我从控制器中删除 Upload-函数,我会收到调用未定义方法的错误form_open_multipart

所以我不知道为什么我会得到我首先说的错误。有人可以帮助我吗?

提前致谢

使用此插件 http://www.plupload.com/example_queuewidget.php...它对我来说效果很好很多次。