File Chooser plugin in ionic

Hi Team,

I need a plugin which can choose any file from phone and convert that file to base64 .urgently required such thing please help me out with this if anybody know.


have you tried thiss?

Hi, @chandelkushal

Try this:

Add file chooser, file path and base64 native plugins and import in your module file

Now, you add this code in your component file

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { FileChooser } from '@ionic-native/file-chooser';
import { FilePath } from '@ionic-native/file-path';
import { Base64 } from '@ionic-native/base64';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {

  constructor(public filePath: FilePath, public fileChooser: FileChooser, public base64: Base64, public streamingMedia: StreamingMedia, public navCtrl: NavController) {


    // choose your file from the device => {
        // get file path
		.then(file => {
			let filePath: string = file;
			if (filePath) {
                // convert your file in base64 format
                .then((base64File: string) => {
				}, (err) => {
		.catch(err => console.log(err));
	.catch(e => alert('uri'+JSON.stringify(e)));


Now, call this function add this code in your templet file

<button ion-button (click)="fileChoose()">Choose file</button>

Thank you

How can we extract only audio from file manager using File Chooser

getAudio() {
      // let filter={"mime": "audio/mp3"}{ "mime": "audio/mp3" }).then
    (uri => {
    console.log(uri+" THE VALUE OF THE URI")
    this.filepath.resolveNativePath(uri).then(path =>
        console.log("path After the resolved native path"+path)
    // this.copyFileToLocalDir(uri);
    .catch(e => console.log(e));

i’ve tried above code , its does what i asked it lists only audio,but the problem is i cant select is …is there is anyother way or any other plugin to perform this duty

i’m trying to add multiple mime type for the file chooser like{ “mime”: “application/pdf,image/png” }).then((uri) => console.log(uri)); but i cannot select any pdf or image file . is there a solution for addidng multiple mime type to file chooser

for images you can use imagePicker plugin! and for choosing files describe the file type as “files”

    let options = {
      mime: "files"

try this
and i dont thinks so you can’t add multiple mime type if you wanna choose everything leave the mime field empty

1 Like