0

我知道之前有人问过这个问题,但是我尝试过的一切似乎都不起作用......我正在使用BlueImp 的jQuery File Upload,我需要进行跨域上传(来自 admin.cookingwiththecooks .net 到 wwwdev.cookingwiththecooks.net)

我已经研究了如何做到这一点,这是我的标头index.php(在接收服务器上)

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: *');

在我看来是正确的...

当我去上传文件时,我得到这个错误:

XMLHttpRequest 无法加载http://wwwdev.cookingwiththecooks.net/。Access-Control-Allow-Origin 不允许来源http://admin.cookingwiththecooks.net 。

所以显然标题有问题。谁能帮我这个?如果需要更多信息,请告诉我...

顺便说一句,上传文件夹确实具有写入权限。谢谢!

编辑:我现在正在研究为此使用 iframe 的可能性...

这是我的 Javascript 代码,你能确定我做对了吗?

$('#new-recipe-form').fileupload({
    forceIframeTransport: true,
    url: 'http://wwwdev.cookingwiththecooks.net/',
    disableImageResize: false,
    dropZone: $('#dropzone'),
    imageMaxWidth: 1800,
    imageMaxHeight: 1800,
});

$('#new-recipe-form').fileupload(
    'option',
    'redirect',
    'http://admin.cookingwiththecooks.net/recipes/result.html?%s'
);

我确实创建了result.html,据我所知,它应该是空白的......?

这是我使用的链接:https ://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads#cross-site-iframe-transport-uploads

再次感谢!

4

1 回答 1

0

找不到解决方案,所以我只是使用 FTP 将其上传到另一个域...

于 2013-08-28T13:50:34.597 回答