0

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

欢迎类扩展 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);
}

}

为什么?

4

1 回答 1

1

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

于 2013-09-09T11:17:44.410 回答