本文介绍了流星Lepozepo Cloudinary生成签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用上传流星图像。一个>包。但是我不太确定如何生成一个URL。没有它,我会收到401错误。

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.

服务器

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

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

客户

$.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.

这篇关于流星Lepozepo Cloudinary生成签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 23:20