2012-08-13 47 views
0

希望有人可以帮助我解决这个问题。使用CI创建多个文件上载表单

我正在开发一个允许使用CodeIgniter和jQuery上传多个文件以允许使用一个uploadfield上传多个文件的表单。

但现在我得到以下ERRMSG在Firebug:

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); 
     } 
    } 
} 

所以,我首先想到的是我还没有decleared元标记在头但事实并非如此:

<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> 

如果我从控制器中删除上传功能我得到一个错误的调用未定义的方法form_open_multipart

所以我不知道为什么我得到errmsg我第一次表示。有人能帮助我吗?

在此先感谢

+0

你能从发布消息的页面发布源HTML吗? – 2012-08-13 18:41:56

+0

生成HTML字符编码消息的HTML页面的源为空... – PimD1988 2012-08-14 05:50:04

+0

这不是问题吗?您正在加载一个空白页面,Firebug会抛出它遇到的第一个错误。你确定你的视图'upload_form'和'upload_success'包含正确的数据吗? – 2012-08-14 11:58:48

回答

相关问题