For some reason I seem unable to add my folder to the list in the ckfinder file browser in an existing backend configuration. I have already tried a lot of things but all I can see it that it should appear based upon the ckfinder config? The folder exists and I have already checked the config numerous times.
There are no errors or logs anywhere...
just based on the default config here just omitted the non relevant parts (I think) https://github.com/ckfinder/ckfinder-laravel-package/blob/master/src/config.php
ckfinder config:
/*=================================== Backends ========================================*/
$config['backends']['myfolder'] = [
'name' => 'myfolder',
'adapter' => 'local',
'baseUrl' => config('app.url') . '/storage/myfolder/',
'root' => storage_path('app/public/myfolder/'),
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
'followSymlinks' => true,
];
/*================================ Resource Types =====================================*/
$config['defaultResourceTypes'] = 'SomeFolder, OtherFolder, MyFolder';
$config['resourceTypes'] = [
[
'name' => 'MyFolder',
'directory' => 'myfolder',
'label' => 'MyFolder',
'maxSize' => '8M',
'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,ico,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,svg,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip',
'backend' => 'myfolder',
],
];
/*================================ Access Control =====================================*/
$config['roleSessionVar'] = 'ckfinder.user_role';
$config['accessControl'][] = [
'role' => '*',//'role' => 'Admin',
'resourceType' => 'MyFolder',
'folder' => '/',
'FOLDER_CREATE' => true,
'FOLDER_RENAME' => true,
'FOLDER_DELETE' => true,
'FILE_UPLOAD' => true,
'FILE_RENAME' => true,
'FILE_DELETE' => true,
'IMAGE_RESIZE' => true,
'IMAGE_RESIZE_CUSTOM' => true,
];
some middleware for setting a user role:
class CkFinderUserRoleMiddleware
{
public function handle(Request $request, Closure $next): mixed
{
//some code omitted
$_SESSION['ckfinder.user_role'] = //function that aquires admin value
config()->set([
'ckfinder.backends.myfolder.baseUrl' => env('APP_URL') . storage_path('app/public/vrp'),
'ckfinder.backends.myfolder.root' => storage_path('app/public/vrp'),
]);
return $next($request);
}
}
ck finder options in vue component:
let vm = this;
let CKFinderOptions = {
chooseFiles: true,
width: this.width,
height: this.height,
onInit: function (finder) {
finder.on('files:choose', function (evt) {
let file = evt.data.files.first();
let url = file.getUrl();
let protocol = url.indexOf('://') + 3;
vm.loadAsset(url.substring(url.indexOf('/', protocol)));
});
finder.on('file:choose:resizedImage', function (evt) {
let url = evt.data.resizedUrl.getUrl();
let protocol = url.indexOf('://') + 3;
vm.loadAsset(url.substring(url.indexOf('/', protocol)), true);
});
}
};
if (this.path) {
CKFinderOptions.rememberLastFolder = false;
CKFinderOptions.startupPath = `${this.resourceType}:${this.path}`;
}
CKFinder.popup(CKFinderOptions);