0

我已经设置了 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
                },

似乎没有什么不同。谢谢!

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

{"success":true,"msg":{"time":1383755346,"hash":"86dd782965cb25d4be96ccce11ae4b63","type":"image/jpg","size":40207},"uuid":"62031b35- c596-4fbe-9d11-16f50b0a8a8e"}

4

1 回答 1

0

这似乎有效:

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

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

    $data = json_encode($output);
    echo $data;
于 2013-11-06T20:38:01.410 回答