Hello everybody,
I'm french so I'm sorry to my mistakes. My configuration is elFinder 2.1.14 and I would to use startPath option to open a specific folder with url post information.
============ connector.php ============
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => $root_init.'classement/',
'startPath' => isset($_GET['startPath']) ? $_GET['startPath'] : $root_init.'classement/',
'URL' => dirname($_SERVER['PHP_SELF']) . '/stockage/classement/',
)
)
============ explorer.js ============
$('#elfinder').elfinder({
url : link_connector+'/connector.minimal.php,
lang: 'fr',
customData : { 'startPath' : folder_root },
rememberLastDir : 'false',
commands : [
'open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
'download', 'search', 'info', 'view', 'resize', 'sort'
]
});
With folder_root is my variable to subfolder that I would open...
I have no errors in console but startPath has no effect.
Could you help me? I forget something but I don't see what...
Thank you.
@AIRSInformatique It does not work, because it is too late timing. Please consider using the startPathHash of client options.
Ok @nao-pon , startPath is deprecated...
But how can I use startPathHash ? I don't understand which string I must replace in elfinder.options.js for startPathHash...
If you want to find the hash in script can be obtained with the following code. (In the case of a standard hashing method)
JavaScript (Not support IE8, IE9)
var volumeId = 'l1_';
var path = 'path/to/target'; // without root path
//var path = 'path\\to\\target'; // use \ on windows server
var hash = volumeId + btoa(path).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.').replace(/\.+$/, '');
PHP
$volumeId = 'l1_';
$path = 'path/to/target'; // without root path
//$path = 'path\\to\\target'; // use \ on windows server
$hash = $volumeId . rtrim(strtr(base64_encode($path), '+/=', '-_.'), '.');
e.g.
$('#elfinder').elfinder({
url : link_connector+'/connector.minimal.php',
lang: 'fr',
startPathHash : 'l1_' + btoa('path with out root path').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.').replace(/\.+$/, ''),
rememberLastDir : 'false',
commands : [
'open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
'download', 'search', 'info', 'view', 'resize', 'sort'
]
});
Thank you!
It's perfect and it works!
eFinder 2.21. Is it official startPath is dead and deprecated, and replaced by startPathHash?
@donShakespeare
Is it official startPath is dead
There is a bug of LocalFileSystem driver. I'll fix it.
Has the startPath bug been fixed? Currently trying to use it and it is not working. Currently using the startPathHash method and it only works once.
@mcarpenterjr There is a priority order to determine the initial folder.
startPathHashrememberLastDir to false to disables)startPathStill having trouble with startPath which worked perfectly all this while.
I resorted to startPathHash but now it won't open the tree nav to correct folder.
That is, if the path is two or more levels deep, the tree nav will not open.
Any ideas?
@mcarpenterjr did you ever get startPath to work again?