角度和云集成错误?

时间:2017-02-11 04:31:07

标签: angularjs cloudinary

我在下面提到的github中使用clodinary - angular app https://github.com/cloudinary/cloudinary_angular

但在该应用中,它只显示带图像预设的上传图片。但我需要使用API​​密钥上传图片。我将代码更改为

在我的app.js

app.config(['cloudinaryProvider' , function (cloudinaryProvider) {
            cloudinaryProvider
            .set("cloud_name", "********")
            .set("api_key", "**********")
            .set("api_secret", "****************");
            //.set("upload_preset", "*******");

        }
    ]);

I commented upload preset and changed 'unsigned' to 'signed' in cloudinary dashboard.

在我的服务中

promise = $upload.upload({
                                    url: "https://api.cloudinary.com/v1_1/" + cloudinary.config().cloud_name + "/upload",
                                    data: {
                                        api_key: cloudinary.config().api_key,
                                        api_secret: cloudinary.config().api_secret,
                                        tags: 'myphotoalbum',
                                        context: 'photo=' + title,
                                        file: file
                                    }
                                }).progress(function (e) {})
                                .success(function (data, status, headers, config) {
                                    return data;
                                }).error(function (data, status, headers, config) {
                                    return data;
                                });

但它显示“错误请求错误”。如何解决此问题。请帮助我并提前致谢。

0 个答案:

没有答案