我的目标是设置elFinder初始化时的当前上传目录。例如,我的“上传文件”链接有所需的工作目录,它是动态生成的。如何将目录传递给elFinder?elFinder:设置当前上传目录
0
A
回答
1
是的,我想动态获取哈希值。
这个怎么样。
$encode_func = function ($path, $root) {
$p = $path == $root ? '' : substr($path, strlen($root)+1)
if ($p === '') {
$p = DIRECTORY_SEPARATOR;
}
$hash = $this->crypt($p);
$hash = strtr(base64_encode($hash), '+/=', '-_.');
$hash = rtrim($hash, '.');
return $hash;
};
$id = '[uniqueId]_'; You must set same id into root option
$root = realpath('../image/data/');
$path = realpath('../image/data/product');
$hash = $id.$encode($path, $root);
$url_hash = '#elf_'.$hash;
2
elFinder 2.1可以直接打开URL散列的任何文件夹。
ex。
0
基于nao-pon和elfinder类的简单的东西。
第1步: //在php中从您的文件路径中创建散列,例如目录名( “根/图像/ iphone/iphone-6S.jpg”)。 它大多只是BASE64_ENCODE
function elfinder_hash_path($path)
{
if ($path == '')
$path = DIRECTORY_SEPARATOR;
$hash = substr($path, strlen("root-name")+1);
// hash is used as id in HTML that means it must contain vaild chars
// make base64 html safe and append prefix in begining
$hash = strtr(base64_encode($hash), '+/=', '-_.');
// remove dots '.' at the end, before it was '=' in base64
$hash = rtrim($hash, '.');
// append volume id to make hash unique
return "l1_". $hash;
}
“L1” 是elfinder自动卷ID为第一个本地文件系统。 否则,你可以在设置选项connector.php“ID” =>“身份识别码”你的卷ID,
第2步: 如果从JS调用elfinder窗口,elfinder初始化在此之后, 绑定elfinder onload事件跳到到你想要的目录。 在这种情况下,保存在JS变量hasher,从PHP获得。
var elf = $('#elfinder').elfinder({
url : 'elfinder/php/connector.php', // connector URL (REQUIRED)
lang: 'sk',
height: okno_vyska
}).elfinder('instance');
elf.bind('load', function(event) { elf.exec('open', hasher); });
更新:
elf.exec(“开放”,散列器)不工作,如果这个js会议散列子子目录尚未打开,因此它不是在缓存和elfinder什么都不做。
解决方法:要么使用本地存储
window.location.hash = hasher;
或更新上次使用的目录精灵的init
localStorage.setItem('elfinder-lastdirelfinder', hasher);
相关问题
- 1. elfinder设置动态上传路径
- 2. ElFinder +隐藏目录
- 3. 将vim当前工作目录设置为当前项目根目录或当前文件的目录
- 4. WebStorm Dart设置当前工作目录
- 5. 在C中设置当前目录#
- 6. 设置JFileChooser打开当前目录
- 7. Ocaml:设置当前工作目录?
- 8. 如何设置当前工作目录?
- 9. 运行SimpleHTTPServer时设置当前目录
- 10. 设置当前目录 - 苹果脚本
- 11. Android:在GridViewPager上设置当前项目
- 12. 将JFileChooser当前目录设置为远程目录
- 13. 当前目录设置Cookie及其子目录中唯一
- 14. ElFinder - 禁止拖放目录
- 15. 当前目录
- 16. 如何将NAnt项目的basedir设置为当前目录?
- 17. 查找当前目录和子目录包括当前目录
- 18. 如何设置上传目录? PHP,jQuery文件上传
- 19. uid设置上的目录
- 20. 在当前目录
- 21. 从当前目录
- 22. 如何将当前工作目录设置为脚本的目录?
- 23. 哪个autocmd事件用于将当前目录设置为当前窗口中文件的目录?
- 24. 当前登录用户的设置ID
- 25. 如何从当前目录上传厨师菜谱?
- 26. Elfinder连接到远程目录
- 27. 如何在Vim中设置工作/当前目录?
- 28. 你能从java命令行设置当前运行目录吗?
- 29. 如何在Python sh模块中设置当前工作目录?
- 30. howto设置相对于当前目录的符号引用
由于之前。还有一个问题 - 如何生成散列?你能提供一个例子吗?假设我在connector.php \t'path'=>'../image/data/'和'URL'=>'../image/data/',并且需要打开../image/data/product/ – ymakux 2015-04-07 04:30:48
请通过网络浏览器访问您的elFinder并将cwd更改为'product',然后检查位置栏。或者你想要动态获取哈希? – 2015-04-08 07:15:22
是的,我想动态获取哈希。 – ymakux 2015-04-08 15:21:56