Search code examples
ionic-frameworkionic4ionic-native

ionic 4 file chooser not allowing to select multiple files


I'm new to Ionic. I wanted to select multiple images from the gallery and send to the server.

I'm using Ionic 4 "File Chooser" (https://ionicframework.com/docs/native/file-chooser) to select files and "File Transfer" to transfer file. From the "file chooser" I can select ONLY one file. But I wanted to select multiple files ( multiple images ).

Is this possible? If not what are the alternative solutions to select multiple images from the Gallery to transfer to the server.

There should be a solution for this as this is a common scenario.


Solution

  • For an alternative you should check out Image Picker which lists itself as:

    Cordova Plugin For Multiple Image Selection

    You can see it here

    Seems usage is straightforward:

    import { ImagePicker } from '@ionic-native/image-picker/ngx';
    
    
    constructor(private imagePicker: ImagePicker) { }
    
    ...
    
    this.imagePicker.getPictures(options).then((results) => {
      for (var i = 0; i < results.length; i++) {
          console.log('Image URI: ' + results[i]);
      }
    }, (err) => { });