mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
5
Getting encoded hash from the path
rribou edited this page 2019-11-28 09:57:54 +01:00
If you want to find the hash in a script, it can be obtained with the following code. (In the case of a standard hashing method)
JavaScript (No support for 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(unescape(encodeURIComponent(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), '+/=', '-_.'), '.');