I’ Am using slingshot which is a project enhanced by @mikkelking.
Actually, it is my first time to use storage system with Meteor. I found that there are many different solution to insure the storage operations like : Slingshot, Meteor-jalik-ufs which is used by RocketChat and Ostrio:file.
During the use of Slingshot, I have faced some issues, because i was using S3 in a local environment.
I think the code below will explain what I want to say:
Slingshot.createDirective("myFileUploads", Slingshot.S3Storage, {
bucket: "dev",
acl: "public-read",
storageClass: 'REDUCED_REDUNDANCY',
bucketUrl:"http://127.0.0.1:9000",
authorize: function () {
//Deny uploads if user is not logged in.
if (!this.userId) {
var message = "Please login before posting files";
throw new Meteor.Error("Login Required", message);
}
return true;
},
key: function (file) {
//Store file into a directory by the user's username.
var user = Meteor.users.findOne(this.userId);
return user.username + "/" + file.name;
}
});
Error:
<Error><Code>BadRequest</Code><Message>An error occurred when parsing the HTTP request POST at '/'</Message><Resource>/</Resource><RequestId></RequestId><HostId>3795b201-44ae-4429-b3a8-6b5fbf98db90</HostId></Error>