【发布时间】:2014-05-15 18:45:59
【问题描述】:
远程上传:通过给定的 URL 上传文件。
我想使用blueimp 插件向我的网站添加远程上传。
我找到了这个链接:https://gist.github.com/blueimp/5075976,但是我使用外部服务器上传我的文件,所以当我编写这段代码时,我得到了错误:
Uncaught SecurityError: Blocked a frame with origin "http://myExternalURL.com" from accessing a frame with origin "http://www.myMainWebsite.com". Protocols, domains, and ports must match.
带有url的部分代码:
$('#remote-file-copy').on('submit', function (e) {
e.preventDefault();
var url = $(this).find('input').val(),
iframe = $('<iframe src="javascript:false;" style="display:none;"></iframe>');
if (url) {
iframe
.prop('src', 'http://I-USE-EXTERNAL-URL/remote-file-copy.php?url=' + encodeURIComponent(url))
.appendTo(document.body);
}
});
我该如何解决?
非常感谢! 对不起我的英语
【问题讨论】:
标签: php jquery file-upload same-origin-policy blueimp