Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49308

Upload Multiple Images to Firebase Storage And GetDownload URL

$
0
0

@pnchlC wrote:

Im Using Ionic Image Picker(Native) to Get Multiple Images to an array.in array file look like this

file:///data/user/0/io.ionic.starter/cache/tmp_IMG_20180520_182034263619941.jpg

My ionic Image Picker Code is Here

getImages(){
let option = {
  title:"Selec Your Images",
  message:'You can only select 5 Images',
  maximumImagesCount:5,
  outType:1
}
this.imgPicker.getPictures(option).then((results) => {

for(let i=0; i < results.length;i++){
       console.log(results[i]);
       this.images[i]=results[i];
  };
 },(err)=> {
  console.log("Get Image faild");
})

I Use This Method To Upload File and Get the Download URL But it Didn’t Work.Even File Not Uploaded To The Firabase Storage.

 if(this.images.length > 0){
    for (var i=0; i<this.images.length; i++) {
       firebase.storage().ref('/images').putString(this.images[i], 'data_url',{contentType: 'image/jpg'}).then((data)=>{
        this.userPost.photos[i]=data.downloadURL
       console.log( 'this is download url '+this.userPost.photos[i]);
      })
    }
  }

Im Stuck In This Problem Long Time.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>