嗨,我正试图让选择器工作。文件将通过页面上传到我的 S3 存储桶,在 Chrome 的控制台中返回以下两个错误:
不安全的 JavaScript 尝试从带有 URL https://www.filepicker.io/dialog/open/?key=AJNd2634XTeyMNPGjr51mz&id=1350365313264&referrer=localhost&iframe=true&s=的框架访问带有 URL file://localhost/Users/ben/fpiotest.html 的框架1,3,2,12&multi=true&m=image/ *#/computer/. 域、协议和端口必须匹配。swfobject_src.js:1
未捕获的 FilepickerException:获取元数据的文件无效:0。不是文件选择器 url 或 FPFile 对象。文件选择器.js:1
我的页面的整个代码如下:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="jquery-1.8.2.js"></script>
<!-- Adds the Filepicker.io javascript library to the page -->
<script src="https://api.filepicker.io/v1/filepicker.js"></script>
<script src="https://api.filepicker.io/v1/filepicker_debug.js"></script>
<script type="text/javascript">
//Seting up Filepicker.io with your api key
filepicker.setKey('<removed>');
</script>
</head>
<button style="margin-top: 35px" class="btn btn-primary" data-name="complex get"
onClick="filepicker.pickMultiple(
{
mimetype: 'image/*',
'container':'modal',
'metadata': true,
'services': ['COMPUTER', 'FACEBOOK', 'DROPBOX', 'FLICKR']
},
function(files){
var str = '';
//$('#multiResult').html(JSON.stringify(files));
for(var file in files) {
filepicker.stat(file, {size: true, filename: true, width: true, height: true, uploaded: true},
function(metadata){str += JSON.stringify(metadata);});
}
alert(str);
},
function(err){alert('error: ' + err);});">Run Code</button>
<!--function(response){$('#multiResult').html(JSON.stringify(response))});">Run Code</button>-->
<div class="row-fluid">
<div class="span2"><strong>Result:</strong></div>
<div class="span10">
<pre id="multiResult"></pre>
</div>
</div>
</html>