Generally when I load elfinder, it loads file browser. But I want to load file uploader as default, so that use don't need to select upload file from context menu. Is there any option to do so?
@ashickurnoor Register the command to open the upload dialog with bind in the "load" event.
var fm = $('#elfinder').elfinder(opts).elfinder('instance');
fm.bind('load', function() {
fm.one('open', function() {
fm.exec('upload', [fm.cwd().hash]);
});
});
@nao-pon I tried like this
elFinder = $('#elfinder').elfinder({
url : 'explorer/php/connector.minimal.php',
ui : [],
width : 600,
height: 400
}).elfinder('instance');
elFinder.bind('load', function(){
elFinder.one('open', function(){
elFinder.exec('upload', [elFinder.cwd().hash]);
});
});
But it is not working. Did I wrong somewhere?
maybe... do not use elFinder in global scope.
var elFinderInstance = $('#elfinder').elfinder({
url : 'explorer/php/connector.minimal.php',
ui : [],
width : 600,
height: 400
}).elfinder('instance');
elFinderInstance.bind('load', function(){
elFinderInstance.one('open', function(){
elFinderInstance.exec('upload', [elFinder.cwd().hash]);
});
});
or
(function() {
var elFinder = $('#elfinder').elfinder({
url : 'explorer/php/connector.minimal.php',
ui : [],
width : 600,
height: 400
}).elfinder('instance');
elFinder.bind('load', function(){
elFinder.one('open', function(){
elFinder.exec('upload', [elFinder.cwd().hash]);
});
});
})();
It works. Thanks
Most helpful comment
maybe... do not use
elFinderin global scope.or