Will Same plugin work on Ionic 2, I am trying the same for Ionic 2 but getting the following error on real device
[Error] EXCEPTION: undefined is not an object (evaluating ‘a.plugins.fileChooser.open().then’)
FilePicker is Available & returning true, Following is my code
fileChooser = {
open () : Promise {
console.log(‘FilePicker will Load in new Way’);
return FilePicker.pickFile().then((uri) => {
return uri;
}, (err) => {
console.log(‘Failed to Load’);
});
},
}
Well, for Android I’m using the file chooser plugin but for iOS I’ve switched from the “FilePicker” plugin to a simple HTML5 “file” input element, which turns out to be easier to use AND functionally superior … see here how to implement it:
Actually I did not literally use the code from the gist, I still had to make a few changes to get it working properly (with the code from the gist the “onchange” event didn’t always fire). If anyone is interested in my final solution then I can post it here.
And for iOS 9 and higher you need to configure “entitlements” (for iOS 10 therre’s even an additional requirement), all in all I think I spent the better part of a week just to get the iOS solution working!
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.
**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 **
@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?
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.