elFinder - 从用户输入动态加载路径

时间:2015-03-25 14:57:38

标签: php elfinder

我在本地xampp服务器上安装了elFinder v2.1文件管理器。 一切似乎都很好。下面是我的connector.php;

function access($attr, $path, $data, $volume) {
return strpos(basename($path), '.') === 0
    ? !($attr == 'read' || $attr == 'write')
    :  null;}

$emp_id = 'sm_dir_name';
$opts = array(
    'bind' => array(
    'mkdir mkfile rename duplicate upload rm paste' => array($myLogger, 'log'),
       ),
       'roots' => array(
          array(
             'driver'         => 'LocalFileSystem',
             'path'           => '../../lib/lib_emp/'.$emp_id,
             'URL'            => dirname($_SERVER['PHP_SELF']) . '/../../lib/lib_emp/'.$emp_id, 
             'accessControl'  => 'access',             
             'uploadOverwrite'=> false,
        'debug'               => false,
        'arc'                 => '7za',
        'fileURL'             => true,
etc...;

这是我的index.php文件,我在其中启动了elFinder;

$(document).ready(function() {
var elf = $('#elfinder').elfinder({
           url             : 'css/connector.php',
           commandsOptions : {
              edit            : {
                        mimes : ['text/plain', 'text/html', 'text/javascript', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], //types to edit
              editors: [{
                        mimes : ['text/plain', 'text/html', 'text/javascript', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
          load: function(textarea) {
            $(textarea).ckeditor();
          },
          close: function(textarea, instance) {
            CKEDITOR.instances[textarea.id].destroy();
          },
          save: function(textarea, editor) {
            textarea.value = $(textarea).val();
            }

          }
        ]
      }
   }
 }).elfinder('instance');
});

我的问题如下:

  1. 如何在页面加载时禁用elFinder自动加载?
  2. 如何使用选定的目录名称启动elfinder加载(客户端应该向服务器发送类似于$ post方法的值)我想我们可以使用customData : {token : '42', test : 'test'},与elFinder启动。 我不知道如何从connector.php中检索这些值。 每次用户点击load_emp按钮时,elFinder都应刷新并指向选定的目录。
  3. 我正在搜索这个以及更多关于elFinder的信息,因为一个月之后。 elFinder开发团队的文档和支持非常差。

    我恳请您回答这个问题以及未来的问题。

    最诚挚的问候,

    Supun

1 个答案:

答案 0 :(得分:3)

  

如何在页面加载时禁用elFinder自动加载?

客户端配置“rememberLastDir”(https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1#rememberLastDir

  

如何启动elfinder加载选定的目录名称

连接器配置“startPath”(https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1#startPath

OR

使用网址哈希

离)

  • hypweb.net/elFinder-nightly/demo/2.1/#elf_l2_Lw
  • hypweb.net/elFinder-nightly/demo/2.1/#elf_l1_V2VsY29tZQ