Help to upload image to firebase storage in Ionic

I’m trying to upload captured image to firebase storage after edit it by some custom editor.

Custom editor return image path such as “file:///… .jpg” so how can I upload the image by using this path ?

Here is my uploading code u may found any mistakes

private uploadPhoto(): void {
          let loader = this.loadingCtrl.create({
             content: ""
		   return this.myPhotosRef.child(this.generateUUID()).child('myPhoto.JPEG').putString(this.currentDocumentImageUri, => {
				this.currentDocumentImageUri = savedPicture.downloadURL;
					url: this.currentDocumentImageUri,
					date: new Date().toISOString()

You are currently putting a string to Firebase, which is in your case only the path to the file. If you want to use putString, you need the base64 data of the image.

You can try to use the Ionic Native File Plugin and resolve the path from your image to a real image object which you could then put to Firebase!

1 Like