在客户端我有:
'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-lib\node_modules\fibers\future.js:245 W20160212-11:50:43.857(2)?(STDERR)抛出(前);W20160212-11:50:43.857(2)?(STDERR) ^ W20160212-11:50:43.858(2)?(STDERR)错误:匹配错误:匹配失败。字段区域 W20160212-11:50:43.858(2) 中的验证在哪里?(STDERR) 检查时 (packages/check/match.js:33:1) W20160212-11:50:43.858(2)?(STDERR) 在新的 Slingshot.Directive (packages/edgee_slingshot/packages/edgee_slingshot.js:304:1) W20160212-11:50:43.858(2)?(STDERR) 在 Object.Slingshot.createDirective (packages/edgee_slingshot/packages/edgee_slingshot.js:274:1) W20160212-11:50:43.858(2)?(STDERR) 在服务器/slingshot.js:5:1 W20160212-11:50:43。859(2)?(STDERR) 在服务器/slingshot.js:23:1 W20160212-11:50:43.859(2)?(STDERR) 在 somepath.meteor\local\build\programs\server\boot.js:242:10 W20160212-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-lib\node _modules\underscore\underscore.js:79:11) W20160212-11:50: 43.860(2)?(STDERR) 在 path.meteor\local\build\programs\server\boot.js:137:5
谢谢你的帮助。