简体   繁体   English

Kinvey AngularJS图像上传内容类型标题

[英]Kinvey AngularJS Image Upload Content-Type Header

I'm using the AngularJS library of Kinvey. 我正在使用Kinvey的AngularJS库。 Right now, I can successfully upload an image to Kinvey's Files . 现在,我可以成功地将图像上传到Kinvey的Files了 I see that my image file is successfully uploaded. 我看到我的图像文件已成功上传。 The problem is I'm getting an error from the promise of the upload function. 问题是我从上载功能的承诺中得到了一个错误。

Image file: 图像文件:

$scope.onFileSelect = function(element) {
    if (element.files[0]) {
        $scope.selectedImage = element.files[0];
    }
    console.log($scope.selectedImage);
};

Upload function: 上传功能:

var promise = $kinvey.File.upload($scope.selectedImage, {
    mimeType  : $scope.selectedImage.type,
    size      : $scope.selectedImage.length
});

promise.then(function(response) {
    console.log('Uploaded image successfully');
    uikit.notificationTop('Uploaded new image', 'success');
    console.log(response);
}, function(err) {
    uikit.notificationTop('Error in uploading new image', 'danger');
    console.log(err);
});

This is the error I'm getting: 这是我得到的错误:

Error: Response Content-Type header is set to text/html; 错误:响应Content-Type标头设置为text / html; charset=UTF-8. 字符集= UTF-8。 Expected it to be set to application/json. 期望将其设置为application / json。

Kinvey's team noticed this bug issue and fixed it. Kinvey的团队注意到了此错误问题并进行了修复。

1.6.8 - Feb 10, 2016 1.6.8-2016年2月10日

Bugfix: Do not check response type for file uploads from Google. 错误修正:不检查从Google上传文件的响应类型。 Bugfix: Do not send an empty username/password in a login request. 错误修正:不要在登录请求中发送空的用户名/密码。

Thanks Kinvey! 谢谢金维!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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