File upload using Cloudinary package. How to sign upload? [SOLVED]


#1

Trying to upload images to cloudinary. But i think i need to generate a signed upload. Anyone know the process to this?
Here is the package https://github.com/Lepozepo/cloudinary


#2

Figured out that my cloud name was incorrect. I mistaken it for another field. The following code should work per the example given your credentials are correct.

Server

Cloudinary.config({
    cloud_name: 'sample',
    api_key: '1234567890',
    api_secret: '1AbCDEE789101010'
});

Cloudinary.rules.signature = function() {
  return this.userId;
};

Client

$.cloudinary.config({
cloud_name: 'your-cloud-name',
api_key: '1234567891234567'

});

'change #image-upload' (event) {
    let files;
    files = event.currentTarget.files;
    return Cloudinary.upload(files, {
        api_key: '1234567891234567'
    }, function(err, res) {
        console.log("Upload Error: " + err);
       console.log("Upload Result: " + res);
    });
}