Search code examples
javascriptphpelfinder

select and return an array of selected files in elfinder


I'm using elFinder file manager. that is great and easy to use.

that has multi select files capability . but I want to use it for select some files then by pressing enter keyboard button, path of those files Be returned as an Javascript Array.

This is My code to initialize elFinder instance :

$('.add-item').on('click', function () {

    var filesArr = [];

    $('<div id="editor" />').dialogelfinder({
        url: './elfinder/php/connector.minimal.php',
        getFileCallback: function (file) {
            $('#editor').dialogelfinder('close');
            console.log(file.url);
        }
    });


});

that works when select one file but when user select multi files and press enter, all selected files opens for preview only.

How can I do that?


Solution

  • You can configure behaviour of getFileCallback with 'commandsOptions'. In your case you need to alter multiple property and set it to true

    commandsOptions : {
         getfile: {
            multiple: true
         }
    }