我的目标是设置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. Ocaml:设置当前工作目录?
- 3. 运行SimpleHTTPServer时设置当前目录
- 4. 如何设置当前工作目录?
- 5. 在C中设置当前目录#
- 6. 当前目录设置Cookie及其子目录中唯一
- 7. 当前目录
- 8. 查找当前目录和子目录包括当前目录
- 9. 如何设置上传目录? PHP,jQuery文件上传
- 10. Elfinder连接到远程目录
- 11. elfinder配置
- 12. uid设置上的目录
- 13. 如何将当前工作目录设置为脚本的目录?
- 14. 哪个autocmd事件用于将当前目录设置为当前窗口中文件的目录?
- 15. 字VBA设置SPATH作为当前目录
- 16. 如何使用slime设置SBCL的当前目录?
- 17. 如何设置node.js终端以始终显示当前目录
- 18. 你能从java命令行设置当前运行目录吗?
- 19. 如何设置调试过程的当前目录?
- 20. 通过.NET Office在Excel.Application中设置当前目录PIA
- 21. 如何设置fitetype取决于当前目录?
- 22. 执行shell进程时设置当前工作目录
- 23. PHP将当前目录设置为类常量
- 24. maven - 设置当前项目版本
- 25. 当前目录显然不是当前目录
- 26. 如何在OS X上将“查找”命令默认设置为当前目录?
- 27. VBScript当前目录+子目录?
- 28. 上传目录
- 29. 在node.js中获取当前目录上方的一个目录
- 30. 上传前设置专辑名称
由于之前。还有一个问题 - 如何生成散列?你能提供一个例子吗?假设我在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