When i send images to Firebase storage it’s keep loading and doesn’t show anything and all the images size the same “15 b”. It gives me empty images and when I try to open the download URL, it show nothing:
function uploadPicture(options) {
var sourceFileName=""
var sourceDirectory=""
$cordovaCamera.getPicture(options).then(function (sourcePath) {
var sourceDirectory = sourcePath.substring(0, sourcePath.lastIndexOf('/') + 1);
var sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1, sourcePath.length);
sourceFileName = sourceFileName.split('?')[0];
$cordovaFile.copyFile(sourceDirectory, sourceFileName, cordova.file.dataDirectory, sourceFileName)
.then(function (success) {
$scope.uploadedImage = cordova.file.dataDirectory + sourceFileName;
// success - get blob data
var imageBlob = new Blob([success], { type: "image/png" });
alert (sourceFileName)
return saveToFirebase(imageBlob, sourceFileName);
}).then(function (_responseSnapshot) {
// we have the information on the image we saved, now
// let's save it in the realtime database
return saveReferenceInDatabase(_responseSnapshot)
}, function (error) {
alert(error);
});
}, function (err) {
alert(err);
});
};