elfinder 路径修改_如何在elfinder中获取当前目录?

I am using elfinder and I have a problem. I want to get current directory in elfinder but I can not.

EDITED:

this is my connector. consist of my_function that called after upload, rename or mkdir commands and I want to get uploaded files path in specified place:

error_reporting(0); // Set E_ALL for debuging

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';

function access($attr, $path, $data, $volume) {

return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot)

? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true

: null; // else elFinder decide it itself

}

function my_function($cmd, $result, $args, $elfinder)

{

// how to get current path here?

}

$opts = array(

'bind' => array('upload rename mkdir' => 'my_function'),

// 'debug' => true,

'roots' => array(

array(

'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)

'path' => '../files/', // path to files (REQUIRED)

'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)

'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)

),

)

);

// run elFinder

$connector = new elFinderConnector(new elFinder($opts));

$connector->run();

解决方案

You can get items URL.

function my_function($cmd, $result, $args, $elfinder)

{

// how to get current path here?

foreach ($result['added'] as $file) {

if (!empty($file['url']) && $file['url'] != 1) {

$url = $file['url'];

}

}

}

or Make inherent class ex elFinderVolumeMyLocalFileSystem

class elFinderVolumeMyLocalFileSystem extends elFinderVolumeLocalFileSystem

{

public function decode($hash) {

return parent::decode($hash);

}

}

function my_function($cmd, $result, $args, $elfinder)

{

// how to get current path here?

foreach ($result['added'] as $file) {

if ($volume = $elfinder->getVolume($file['hash'])) {

$dir = $volume->decode($file['phash']);

}

}

}

$opts = array(

'bind' => array('upload rename mkdir' => 'my_function'),

// 'debug' => true,

'roots' => array(

array(

'driver' => 'MyLocalFileSystem', // driver for accessing file system (REQUIRED)

'path' => '../files/', // path to files (REQUIRED)

'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)

'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)

),

)

);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值