Recommended Android/IOS file chooser plugin

How to upload multiple files of different types in one go using file chooser?plz help…

After adding this plugin
ionic plugin add https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin.git
and then installing it
npm install FilePicker-Phonegap-iOS-Plugin
I’m not able to import FilePicker . It still giving me an error “Cannot find FilePicker”.

I don’t know whats the issue?
I’m using ionic v2 . May be this plugin doesn’t support the latest version.
Need help?

For file operations, I was advised to use the ‘cordova file plugin’, because it has a large codebase to work with, and understand most of the deal, whatever os (android or ios).

It returns an array if the call is nice, and seems to work well with Ionic 2.

The “File” plugin allows you to work with files, however it does not give you a user interface to select a file … you can (in principle) use the low level file operations to build your own user interface, but to make it user friendly is a tough job, instead you really want to invoke a native file chooser dialog … once the user picked a file, then you can use the File plugin to work with it.

For android we import From "import { FileChooser } from ‘@ionic-native/file-chooser’; "

and installed plugins of filechooser

$ ionic plugin add --save http://github.com/don/cordova-filechooser.git
$ npm install --save @ionic-native/file-chooser

**Could anyone please tell me that from where we will import FilePicker for IOS and from where we will install the plugins for Filepicker in ionic 2 **

This is Ionic 2, I have no opinion on that … the solution I worked on is only for Ionic 1.

@mhartington

Is there now any solution for File chooser for IOS in ionic ??

@vinaysingh7733
did you find any solution ?

@vinaysingh7733
I am facing similar problem, I don’t know how to import the plugin,did you solve the issue on how to use the plugin in ionic v2. Also I wanted to know does this plugin help to choose files from mobile storage or only from iCloud?

Yes I have solved that problem

use this plugin : https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin

@abhisheklamrood

in your .ts file declare

declare var FilePicker: any

and you would be able to use this plugin.
this plugin will allow your app to pick files from your iCloud

@ShehramTahir Thank you very much

1 Like

Hello,
I am using this plugin, and just managed to implement it successfully, but I am only able to fetch files from iCloud storage, how can I fetch files from mobile storage using this plugin. Can anyone share their code for this plugin in Ionic 2

I’ve implemented a file chooser based on the above in my Ionic v1 project.
It works great on iOS and Android v4.1.2.
However, on devices running Android v5 or v6, the call to fileChooser.open() doesn’t seem to do anything.
Any ideas? I’ve searched for solutions but can’t find any way to fix it.

In Ionic v2 File chooser can be used only for android not IOS.

File Chooser Native Plugin :

See Supported Platforms.

I don’t know much about Ionic v1 file chooser plugin.

I would suggest that you should update your project.

From where you want to fetch files ?

e.g : Adobe reader, iBooks or someother software ?

Hi leob. I can’t install cordova-filechooser. the repo is not found, fails to fetch. Any ideas? I need to implement this feature ASAP, being able to choose document files (specifically PDF for now). I need a solution that works on both Android and iOS. the PhoneGap plugin looks good too, allowing selection from iCloud. Haven’t tried it yet, stuck at installing this filechooser plugin.

It seems the repo’s there allright, when I try it it fails but for a different reason … this is what I get:

cordova plugin add http://github.com/don/cordova-filechooser.git
Fetching plugin "http://github.com/don/cordova-filechooser.git" via git clone
Repository "http://github.com/don/cordova-filechooser.git" checked out to git ref "master".
Installing "com.megster.cordova.FileChooser" for ios
 Using this version of Cordova with older version of cordova-ios is being deprecated. Consider upgrading to cordova-ios@4.0.0 or newer.
Error: Cannot find plugin.xml for plugin "org.apache.cordova.dialogs". Please try adding it again.

What’s the message that you’re getting then?

hm weird. I’ve attached a screenshot. I have been able to install the plugin with this command though:
cordova plugin add cordova-plugin-filechooser

I’m not even sure if this is the same plugin, haven’t checked the installed files yet. But I’ve build and tested the app on my Android phone, works great! fileChooser.open() pops up a native dialog for browsing device storage and other available providers. The result returned is a File URI which I can then pass to the file-transfer plugin to get the actual file entry. Brilliant!

I don’t have an iPhone but I can test the app on my MacBook via the iOS Simulator. If this works on iOS as well, it will be the highlight of my day and a very happy christmas indeed.

33

Thanks for the help anyway, much obliged. I’ll repost if I run into trouble, testing on iOS … brb :slight_smile:

Aha, so the trick was to just change the command to “cordova plugin add cordova-plugin-filechooser” … probably something’s changed then, I worked on this a long time ago.

Good that you have it working now (on Android).

For iOS you’ll have to use the other plugin (FilePicker-Phonegap-iOS-Plugin).