Elfinder: how to load file uploader as default when load elfinder

Created on 7 Aug 2017  路  4Comments  路  Source: Studio-42/elFinder

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?

howto

Most helpful comment

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]);
    });
  });
})();

All 4 comments

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hayes-seyah09354085977 picture hayes-seyah09354085977  路  17Comments

bitbybit picture bitbybit  路  13Comments

ShinJii89 picture ShinJii89  路  10Comments

ghigio2000 picture ghigio2000  路  12Comments

gadangmadhulika picture gadangmadhulika  路  16Comments