Hello Team,
can someone help me. I’m trying to upload images gallery to firabse storage.
but it does not work.
here is my code : let me know if something is wrong.
store() {
this.fc.open().then((url) => {
this.fp.resolveNativePath(url).then(resolvenativepath => {
this.returnpath = resolvenativepath;
this.uploadimage();
});
});
}
uploadimage() {
(<any>window).resolveLocalFileSystemURL(this.returnpath, (newurl) => {
newurl.file((resFile) => {
const reader = new FileReader();
reader.readAsArrayBuffer(resFile);
reader.onloadend = (evt: any) => {
const imgBlob = new Blob([evt.target.result], {type: 'image/jpeg'});
const imagestore = this.firestore.ref().child('image');
// tslint:disable-next-line:no-shadowed-variable
imagestore.put(imgBlob).then((newurl) => {
alert('upload ok ...');
}).catch((err) => {
alert('upload nok' + err);
});
};
});
});
}Preformatted text