Closed hoantv1107 closed 1 year ago
I don't believe you can do this in the config.php but you CAN do it via the middleware (app/Http/Middleware/CKFinder.php)
Set the default backend to the base folder that holds all the user folders.
config.php
...
$config['backends']['default'] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => config('app.url') . '/userfiles/',
'root' => public_path('/userfiles/'),
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8'
);
Add a resource for the user folder and set the access control for it.
app/Http/Middleware/CKFinder.php
$resources[] = [
'name' => $user_id,
'directory' => $user_id,
'maxSize' => 0,
'allowedExtensions' => '<whatever you want>',
'deniedExtensions' => '',
'backend' => 'default'
];
...
$accessControl[] = [
'role' => '*',
'resourceType' => $user_id,
'folder' => '/',
'FOLDER_VIEW' => true,
'FOLDER_CREATE' => true,
'FOLDER_RENAME' => true
'FOLDER_DELETE' => true,
'FILE_VIEW' => true,
'FILE_UPLOAD' => true,
'FILE_RENAME' => true,
'FILE_DELETE' => true,
'IMAGE_RESIZE' => true,
'IMAGE_RESIZE_CUSTOM' => true
];
I try to add baseurl with custom url in config.php
$config['backends']['default'] = array( 'name' => 'default', 'adapter' => 'local', 'baseUrl' => config('app.url').'/userfiles/.$user_id', 'root' => public_path('/userfiles/'.$user_id), 'chmodFiles' => 0777, 'chmodFolders' => 0755, 'filesystemEncoding' => 'UTF-8' );
but it not work.