在客户端上,我有:
'change #banner_input': function(){
event.preventDefault();
var uploader = new Slingshot.Upload("myFileUploads");
Slingshot.fileRestrictions("myFileUploads", {
allowedFileTypes: ["image/png", "image/jpeg", "image/gif"],
maxSize: 10 * 1024 * 1024 // 10 MB (use null for unlimited).
});
var fileO = event.target.files[0];
console.log(fileO);
uploader.send(fileO, function (error, downloadUrl) {
if (error) {
// Log service detailed response.
console.error('Error uploading', uploader.xhr.response);
}
else {
alert(downloadUrl);
// Meteor.users.update(Meteor.userId(), {$push: {"profile.files": downloadUrl}});
}
});
}
但是当我将其添加到服务器时,即使"空"进行调试,应用程序也会崩溃:
Slingshot.createDirective("myFileUploads", Slingshot.S3Storage, {
});
我得到的错误:
AppData\Local.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-libode_modules\fibers\future.js:245W20160212-11:50:43.857(2(?(STDERR( 投掷(ex(;W20160212-11:50:43.857(2(?(斯特德( ^W20160212-11:50:43.858(2(?(斯特德(错误: 匹配错误: 匹配失败。字段区域中的验证位置W20160212-11:50:43.858(2(?(STDERR( at check (packages/check/match.js:33:1(W20160212-11:50:43.858(2(?(STDERR( at new Slingshot.Directive (packages/edgee_slingshot/packages/edgee_slingshot.js:304:1(W20160212-11:50:43.858(2(?(STDERR( at Object.Slingshot.createDirective (packages/edgee_slingshot/packages/edgee_slingshot.js:274:1(W20160212-11:50:43.858(2(?(STDERR( at server/slingshot.js:5:1W20160212-11:50:43.859(2(?(STDERR( at server/slingshot.js:23:1W20160212-11:50:43.859(2(?(STDERR( at somepath.meteor\local\build\programs\server\boot.js:242:10W20160212-11:50:43.859(2(?(STDERR( at Array.forEach (native(W20160212-11:50:43.859(2(?(STDERR(在功能。.每个..forEach (somepath.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-libode_modules\下划线\下划线.js:79:11(W20160212-11:50:43.860(2(?(STDERR( at path.meteor\local\build\programs\server\boot.js:137:5
感谢您的帮助。
错误:匹配错误:匹配失败。字段区域中的验证位置
区域导致错误。
阅读此区域代码:http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
并尝试从您的属性更改它。