选择并返回elfinder中的一组选定文件 [英] select and return an array of selected files in elfinder
问题描述
我正在使用 elFinder 文件管理器.那很棒而且易于使用.
I'm using elFinder file manager. that is great and easy to use.
.但是我想用它来选择某些文件,然后按enter
键盘按钮,将这些文件的路径作为Javascript数组返回.
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.
这是我的代码,用于初始化elFinder实例:
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);
}
});
});
在选择一个文件时有效,但是当用户选择多个文件并按enter
时,所有选定的文件仅打开以供预览.
that works when select one file but when user select multi files and press enter
, all selected files opens for preview only.
我该怎么做?
推荐答案
您可以使用' multiple 属性并将其设置为true
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
}
}
这篇关于选择并返回elfinder中的一组选定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!