0

hope someone can help me with this.

I am developing a form which allows to upload multiple files using CodeIgniter and jQuery to enable multiple file uploads using one uploadfield.

But now I get the following errmsg in firebug:

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.

Which means that the HTML-document is not decleared but I don't understand what is going wrong.

I have the following controller:

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

So my first thought is that I have not decleared the Meta-tag in the header but that is not the case:

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

And if I remove the Upload-function from the controller I get an error of calling an undefined method form_open_multipart

So I have no idea why I get the errmsg I first stated. Is there someone who can help me with this?

Thanks in advance

PimD1988
  • 307
  • 5
  • 14
  • Can you post the source HTML from the page where you are getting the message? – Dirk de Man Aug 13 '12 at 18:41
  • The source of the HTML-page that generates the HTML character encoding message is empty... – PimD1988 Aug 14 '12 at 05:50
  • Isn't that the problem? You're loading an empty page, Firebug throws the first error that it encounters at you. Are you sure that your views 'upload_form' and 'upload_success' contain the right data? – Dirk de Man Aug 14 '12 at 11:58

1 Answers1

0

Use this plugin http://www.plupload.com/example_queuewidget.php ...Its works well for me so many times.

Pramod Kumar Sharma
  • 7,851
  • 5
  • 28
  • 53
  • that is something similar like Uploadify which I don't want to use because it uses Flash and although it is a small part... I prefer doing it all with jQuery and PHP of course – PimD1988 Aug 14 '12 at 09:02