我有这个功能,使用cordova相机插件在我的手机照片库中选择图像,将其转换为base64然后将其上传到firebase ..我按照firebse文档关于将base64图像上传到firebase存储..不幸的是,它引发了有关负载的错误.. 有人可以帮忙吗?
$scope.changeImage=function(){
document.addEventListener("deviceready", function () {
var options = {
quality: 100,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 500,
targetHeight: 500,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
$scope.cbuddyURL=imageData;
var storageRef = firebase.storage().ref().child('sample');
var upload=storageRef.putString(imageData,'base64').then(function(){
console.log('Uploaded a base64 string!');
})
}, function(err) {
alert(err);
});
}, false);
}