Reputation: 83
I am using CKFinder to upload files to my site where all my users should have their own folder storing their own files in them.
My desired result is that the folder for user files uploaded will be ckfinder/userfiles/$USERNAME
I have the following information in the config.php file of CKFinder that simply is not working for me.
Help very much appreciated and needed.
$docRoot = getenv("DOCUMENT_ROOT");
$siteName = $_SERVER['HTTP_HOST'];
$USERNAME = $_SESSION['thisusername']; // session via main page username value
$baseUrl = 'http://' . $siteName . '/ckfinder/userfiles/';
$baseDir = $docRoot . '/ckfinder/userfiles/';
/*=================================== Backends =====*/
$config['backends'][] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => "/ckfinder/userfiles/",
'root' => $baseDir,
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
);
Upvotes: 0
Views: 763
Reputation: 83
I resolved this by putting into the config.php the following:
$USERNAME = $_SESSION['thisusername'];
if ($USERNAME){
$baseUrl = 'http://www.myurl.org/ckfinder/userfiles/' . $USERNAME . '/';
$baseDir = $docRoot . '/ckfinder/userfiles/' . $USERNAME . '/';
}else{
$baseUrl = 'http://www.myurl.org/images/';
$baseDir = $docRoot . '/images/';
}
Upvotes: 0
Reputation: 1053
you have to use the variable $USERNAME
somewhere, else nothing will happen by itself. Most likely: 'baseUrl' => "/ckfinder/userfiles/" . $USERNAME ."/",
Upvotes: 1