1

I am using CKFinder 3 (widget), after CKFinder has been initiated with a couple of folders, I need in my JS application to programmatically open one specific CKFinder.

As far I know in CKFinder 2 was possible to use from its API an "openFolder" function.

Currently I cannot find any similar function in the documentation.

I would like to know what is the correct way to open a specific folder from JavaScript.

Notes:

I am aware of configuration properties:

startupPath
rememberLastFolder
startupFolderExpanded

which are working at CKFinder initialization.

GibboK
  • 71,848
  • 143
  • 435
  • 658

2 Answers2

1

I have currently found out a solution which consist on using request on CKFinder api.

finder.request('folder:openPath', { path: 'videos:/', expand: true });

This call works, but I am still interested to know if are there other better alternatives.

GibboK
  • 71,848
  • 143
  • 435
  • 658
  • Hi. AFAIR there is no better approach as this request is used internally for opening folder on user events like double click or on keyboard navigation. – jodator Mar 03 '17 at 09:01
  • @jodator thanks guys for your support and confirmation – GibboK Mar 03 '17 at 09:37
0

This code will open the file browser and make the folder cars open:

CKFinder.popup({
    startupPath: 'Course Files:/cars/',
    width: '600',
    height : '400',
    selectActionFunction: function(fileUrl){
            $(el).val(fileUrl);
    }
    });

In config.php of ckfinder if I have specified:

$config['ResourceType'][] = Array(
'name' => 'Course Files',   //Single quotes not allowed
'url' => $baseUrl.'education/course/files',
'directory' => $baseDir.'education/course/files',
'maxSize' => 0,
'allowedExtensions' => 'bmp,csv,doc,docx,fla,flv,gif,7z,gzip,jpeg,jpg,mid,mp3,mp4,pdf,png,ppt,pptx,rar,rtf,tif,tiff,txt,wav,wma,xls,xlsx,zip,xlsm,html,htm',
'deniedExtensions' => '');
Darkhan ZD
  • 580
  • 8
  • 14