I have got into almost every resource on the topic, but still need your help to make this work. I want to directly upload files to my S3 directly from the browser in my Meteor a
Same problem here - I think this is because of Meteor not allowing CORS in the application header. I'm also trying to solve this very urgently.
To get this working I had to add a couple of parameters to the s3.getSignedUrl
call:
ContentType: mimeType,
Body: '',
"ACL": 'public-read'
Full method:
Meteor.methods({
requestUpload: function(filename, mimeType) {
var fut = new Future();
new Fiber(function() {
var params = {
Bucket: MY_BUCKET,
Key: new Date().getTime() + "_" + filename,
ContentType: mimeType,
Body: '',
"ACL": 'public-read'
};
var surl = s3.getSignedUrl('putObject', params, function(err, surl) {
if (!err) {
console.log("signed url: " + surl);
fut.return(surl);
} else {
console.log("Error signing url " + err);
fut.return();
}
});
}).run();
return fut.wait();
}
}
The problem can be that you requesting a SignedUrl for a PUT request but you later on POST the file to S3. You should PUT the file to S3 not POST.
SignedUrls only allow GET and PUT right now.
For more info see this answer: upload-file-from-angularjs-directly-to-amazon-s3-using-signed-url