简体   繁体   中英

Meteor Lepozepo Cloudinary Generate Signature

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);
    });
}

Figured it out. I had this incorrect cloud name. The above code should work as long as all your credentials are correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM