如何使用客户端事件 API 在 elFinder 中记录已删除的文件名?
How can I log removed file name in elFinder with Client-event API?
我正在尝试为 elFinder 创建 Ajax 日志功能,所以我添加了事件处理程序:
'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
}
}
}
从 add
事件中我得到了我需要的所有数据,例如嵌套对象数据的一部分:
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
最重要的是 url
和 name
添加的文件。
但是在 remove
我只得到:
0: "l1_UypQLTJfOC9TY3JlZW5zaG90IDIwMjEtMDMtMTEgYXQgMTUuMTguNDcucG5n"
length: 1
如何在 eFinder 中记录删除的文件名?
Because the path encoding method can be changed with the volume
driver, the client side does not implement a function to decode it.
However, if it is the default encoding method, it can be decoded as
follows.
var hash = 'l1_RG93bmxvYWRz';
var encPath = hash.substr(hash.indexOf('_')+1);
var path = '/'+atob(encPath.replace(/\-/g, '+').replace(/_/g, '/').replace(/\./g, '='));
我正在尝试为 elFinder 创建 Ajax 日志功能,所以我添加了事件处理程序:
'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
}
}
}
从 add
事件中我得到了我需要的所有数据,例如嵌套对象数据的一部分:
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
最重要的是 url
和 name
添加的文件。
但是在 remove
我只得到:
0: "l1_UypQLTJfOC9TY3JlZW5zaG90IDIwMjEtMDMtMTEgYXQgMTUuMTguNDcucG5n"
length: 1
如何在 eFinder 中记录删除的文件名?
Because the path encoding method can be changed with the volume driver, the client side does not implement a function to decode it.
However, if it is the default encoding method, it can be decoded as follows.
var hash = 'l1_RG93bmxvYWRz';
var encPath = hash.substr(hash.indexOf('_')+1);
var path = '/'+atob(encPath.replace(/\-/g, '+').replace(/_/g, '/').replace(/\./g, '='));