How to get an event before loading into the elfinder plugin (file manager plugin)

I am working on a file manager using jquery

here is the code:

var elfinder = $('#elfinder').elfinder({ url: '<?= $connector; ?>', soundPath: '<?= site_url('assets/plugins/elFinder/sounds/rm.wav'); ?>', height: 700, lang: 'zh_TW', uiOptions: { // toolbar configuration toolbar: [ ['back', 'forward'], ['reload'], ['mkdir', 'upload'], ['copy', 'cut', 'paste', 'rm'], ['rename'], ['view', 'sort'] ] }, contextmenu: { navbar: ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'], cwd: ['reload', 'back', '|', 'upload', 'mkdir', 'paste', '|', 'info'], files: [ 'open', 'quicklook', 'sharefolder', '|', 'download', '|', 'copy', 'cut', 'paste', 'rm', '|', 'rename', '|', 'info' ] }, ui: ['toolbar', 'tree', 'stat'], handlers: { add: function (e) { }, upload: function (e, instance) { alert("test1"); //alert("test2"); //return false; //console.log(event.data); //console.log(event.data.selected); // selected files hashes list } } }); 

The problem is

1) I would like to have some check before downloading the file, if it fails, then cancel the download, but in case of adding / uploading it starts after the start of the download and starts several times

2) In addition, it cannot capture the download completion event when loading the event several times

Here is a list of events:

https://github.com/Studio-42/elFinder/wiki/Client-event-API

Any suggestion, thanks for the help.

Updated:

Locate on the server side, there are binding options to override the command, for example. "rm mkdir" etc .... however, I would like to get the user id in the repository, so is there a list of events that I can override on the client side? Thanks

https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options

+5
source share
1 answer

Please redefine the function because there is no hook point before executing the command.

 var elfinderInstance = $('#elfinder').elfinder({ /* Your options */ }).elfinder('instance'); elfinderInstance.upload = function(files) { var hasError; elfinderInstance.log(files); // print to browser consol if (hasError) { elfinderInstance.error('upload error'); return $.Deferred().reject(); } else { return elfinderInstance.transport.upload(files, elfinderInstance); } }; 
+2
source

All Articles