简体   繁体   中英

Kinvey AngularJS Image Upload Content-Type Header

I'm using the AngularJS library of Kinvey. Right now, I can successfully upload an image to Kinvey's 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; charset=UTF-8. Expected it to be set to application/json.

Kinvey's team noticed this bug issue and fixed it.

1.6.8 - Feb 10, 2016

Bugfix: Do not check response type for file uploads from Google. Bugfix: Do not send an empty username/password in a login request.

Thanks Kinvey!

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