0
votes

Do you know how to add the username in the S3 architecture ?

For exemple:

- appname
  - username
    - image1.jpg
    - image2.jpg
    - ...

I am using the amazing cfs:s3 package. But while it's server side, I think I can't use Meteor.user(), even in a method, no ? Here what i did, but actually don't work :


image = new FS.Store.S3("image", {
    accessKeyId: xxx,
    secretAccessKey: xxx,
    bucket: "appname",
    folder: Meteor.call(getUser);
});


Meteor.methods ({

    getUser: function () {
        return Meteor.user();
    }

});

Thank for your help

1

1 Answers

0
votes

Well, I don't know the library you're using but with node aws-sdk you would do something like this:

/* S3 object is initialized before with the correct credentials */

S3.putObject({
  Key         : "a/full/path/to/your/file.jpg",
  Body        : new Buffer(blob, 'binary'),
  Bucket      : "theNameOfYourBucket",
  ContentType : 'image/jpeg',
});

So probably you should replace your folder property with key.