问题
I am trying to upload an image in Meteor with the https://github.com/Lepozepo/cloudinary package. But I am not quite sure how to generate a url. Without it, I get a 401 error.
Server
Cloudinary.config({
cloud_name: 'sample',
api_key: '1234567890',
api_secret: '1AbCDEE789101010'
});
Cloudinary.rules.signature = function() {
return this.userId;
};
Client
$.cloudinary.config({
cloud_name: 'sample',
api_key: '1234567891234567'
});
'change #image-upload' (event) {
let files;
files = event.currentTarget.files;
return Cloudinary.upload(files, {
cloud_name: 'sample',
api_key: '1234567891234567'
}, function(err, res) {
console.log("Upload Error: " + err);
return console.log("Upload Result: " + res);
});
}
回答1:
Figured it out. I had this incorrect cloud name. The above code should work as long as all your credentials are correct.
来源:https://stackoverflow.com/questions/40063115/meteor-lepozepo-cloudinary-generate-signature