Code Igniter + fine-uploader:IE9和is_ajax_request命令

时间:2013-09-09 06:30:06

标签: ajax codeigniter internet-explorer fine-uploader

将精细上传器脚本集成到新的代码点火器安装后,我遇到以下问题:使用“if(!$ this-> input-> is_ajax_request())”命令时,IE 9返回false。 / p>

类欢迎扩展CI_Controller {

public function index()
{
    $this->load->view('upload');
}

public function upload()
{   
    error_reporting(E_ALL | E_STRICT);

    if (!$this->input->is_ajax_request())
    {
        die('No direct script access allowed');
    }

    $this->load->helper("qqFileUploader.class");

    $uploader = new qqFileUploader('uploads');
    // Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
    $uploader->allowedExtensions = array();

    // Specify max file size in bytes.
    $uploader->sizeLimit = 900 * 1024 * 1024; // 900 Megabytes

    // Specify the input name set in the javascript.
    $uploader->inputName = 'qqfile';

    $uploader->prefix = 'test_';

    // If you want to use resume feature for uploader, specify the folder to save parts.
    $uploader->chunksFolder = 'chunks';
    $result = $uploader->handleUpload('uploads');
    $result['uploadName'] = $uploader->getUploadName();

    header("Content-Type: text/plain");
    echo json_encode($result);
}

}

为什么?

1 个答案:

答案 0 :(得分:1)

完全可以预料到这一点。 Fine Uploader不使用XHR上传IE 9及更早版本的文件(因为这是不可能的)。相反,我们会根据iframe构建表单并提交表单。