GibboK
GibboK

Reputation: 73938

How to open programmatically a specific folder in CKFinder 3 - "openFolder" API is missing?

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.

Upvotes: 1

Views: 1344

Answers (2)

Darkhan ZD
Darkhan ZD

Reputation: 610

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' => '');

Upvotes: 0

GibboK
GibboK

Reputation: 73938

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.

Upvotes: 1

Related Questions