I am trying to create Ajax logging feature for elFinder so I added event handlers:
'elfinder': {
handlers : {
add : function(event, elfinderInstance) {
console.log(event.data);
//console.log(event.data.selected); // selected files hashes list
},
remove : function(event, elfinderInstance) {
console.log(event.data);
//console.log(event.data.selected); // selected files hashes list
}
}
}
From add event I get all data I need, part of the nested object data for example:
hash: "l1_UypQLTJfOC9TY3JlZW5zaG90IDIwMjEtMDMtMTEgYXQgMTUuMTguNDcucG5n"
isowner: false
mime: "image/png"
name: "Screenshot 2021-03-11 at 15.18.47.png"
phash: "l1_UypQLTJfOA"
read: 1
size: "60591"
tmb: 1
ts: 1616364008
url: "/php/../files/S%2AP-2_8/Screenshot%202021-03-11%20at%2015.18.47.png"
write: 1
Most importantly url and name of the added file.
But on remove I get only:
0: "l1_UypQLTJfOC9TY3JlZW5zaG90IDIwMjEtMDMtMTEgYXQgMTUuMTguNDcucG5n"
length: 1
How can I log removed file name in eFinder?
See Getting encoded hash from the path to encode and https://github.com/Studio-42/elFinder/issues/2011#issuecomment-302418968 to decode.
You could also try using console.log(fm.path(event.data)); and see if that works.
See Getting encoded hash from the path to encode and #2011 (comment) to decode.
Thanks, I do use custom client root paths with hash, just did not know how to de-hash it.
Most helpful comment
See Getting encoded hash from the path to encode and https://github.com/Studio-42/elFinder/issues/2011#issuecomment-302418968 to decode.
You could also try using
console.log(fm.path(event.data));and see if that works.