# Upload file to firebase -- FileChooser

**URL:** <https://forum.ionicframework.com/t/upload-file-to-firebase-filechooser/75306>\
**Category:** ionic-v3\
**Created:** [January 5, 2017, 5:16pm UTC](https://forum.ionicframework.com/t/upload-file-to-firebase-filechooser/75306 "2017-01-05T17:16:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cposadaa](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cposadaa](https://forum.ionicframework.com/u/cposadaa)\
**Post date:** [January 5, 2017, 5:16pm UTC](https://forum.ionicframework.com/t/upload-file-to-firebase-filechooser/75306/1 "2017-01-05T17:16:49Z")

</div>

Hi i want to upload a file of any type (img, txt, pdf …etc) to firebase, i’am using FileChooser to get the file URI, but to upload the file to firebase i need the file not the URI, if i got the file i can use the put(file) function. My question is how do i get file from the file URI? :

this is the code to get the URI:  
FileChooser.open().then(uri=\>{  
console.log(“uri:”, uri);  
this.presentToast(uri);  
}).catch(error =\> {  
console.error(error);  
this.presentToast(error);  
});

this is the code to upload a file to firebase storage :

```
var uploadTask = this.storage.child(auth.uid+'/'+file.name)
    .put(file);

    uploadTask.on('state_changed',
    (snapshot)=>{
      console.log("subiendo");
    },
    (error)=>{
      console.error(error);
    },()=>{
      console.log("Successsss");
      console.log(uploadTask.snapshot.downloadURL);
    });
```

---

<div class="post-metadata">

**Author:** ![trevaun23](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/trevaun23/32/115596_2.png) [@trevaun23](https://forum.ionicframework.com/u/trevaun23)\
**Post date:** [April 20, 2017, 2:54pm UTC](https://forum.ionicframework.com/t/upload-file-to-firebase-filechooser/75306/2 "2017-04-20T14:54:56Z")

</div>

Hey, I made a topic that answers your question. (I saw your question after uploading lol)

It works on Ionic 2 and 3

> [@Uploading any File (.pdf, .epub , .docx, & More) to Firebase](https://forum.ionicframework.com/t/uploading-any-file-pdf-epub-docx-more-to-firebase/87249):
>
> This works in Ionic 2 & 3 incase you’re wondering. In your page.ts, to upload the files, put: import {FileChooser} from '@ionic-native/file-chooser'; import {FilePath} from '@ionic-native/file-path'; declare var cordova: any; /\* If you want the file opening in browser to automatically download please install the in app browser plugin cordova plugin add cordova-plugin-inappbrowser \*/ constructor( public FilePath:FilePath, public FileChooser:FileChooser, public eventsdata: Even…
