FineUploader 4.0.3访问iFrame响应IE时出错

时间:2013-11-06 00:34:39

标签: php internet-explorer iframe fine-uploader ajax-upload

我已经设置了 FineUploader 4.0.3 ,除了 IE8 / IE9 之外,它在所有浏览器中运行良好。

我得到的回复信息是:

https://www.dropbox.com/s/t367y3zx3z2n9to/Screenshot%202013-11-05%2018.26.17.png

'在处理上传响应期间尝试访问iframe时出错(访问被拒绝。)“

目前我的服务器端代码正在返回响应:

$output = array('success' => true, 'msg' => $msg, 'filename' => $filename);

header('Content-type: text/plain');
echo htmlspecialchars(json_encode($output), ENT_NOQUOTES);

非常感谢任何协助。

在下面添加更新的JS和PHP

    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Headers: origin, x-requested-with, content-type, cache-control');
    header("Content-Type: text/html");
    $output = array('success' => true, 'msg' => $msg, 'uuid' => $uuid);
    $json = json_encode($output);
    echo "$json<script src=\"http://jd.loc/iframe.xss.response.js\"></script>";

JS:

                debug: true,
                uploaderType: 'basic',
                button: $chooseFileBtn,
                multiple: false,
                request: {
                    endpoint: 'file/upload'
                },
                validation: {
                    allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
                    sizeLimit: 2 * (1024 * 1024), // 2 MB
                    itemLimit: 1
                },

请注意我也尝试过使用:

                cors: {
                    expected: true
                },

似乎没有什么区别。谢谢!

同时添加来自服务器的确切响应:

{ “成功”:真, “msg” 中:{ “时间”:1383755346, “散列”: “86dd782965cb25d4be96ccce11ae4b63”, “类型”: “图像/ JPG”, “大小”:40207} “的uuid”: “62031b35-c596-4fbe-9d11-16f50b0a8a8e”}

1 个答案:

答案 0 :(得分:0)

这似乎有效:

    $output = array('success' => true, 'msg' => $msg, 'filename' => $filename, 'uuid' => $uuid);

    header("Content-Type: text/html");

    $data = json_encode($output);
    echo $data;