Saypontigohe
Saypontigohe

Reputation: 311

KCfinder how to use GLOBAL variables

I am using KCfinder for a project, but I am stuck at the moment.

I want a dynamic uploadDir, for example: 'uploadURL' => $_SESSION['user_upload_dir']

However, the config file of KCfinder does not accept any global variables. I read the documentation (https://kcfinder.sunhater.com/integrate#session) but I have no idea what I have to do to get it working. (English is not my main language, so it is hard for me to understand what the documentation wants me to do)

In short I want this:

The reason is because multiple members of the website need to have their own image folder.

All help is appreciated! :)

Upvotes: 0

Views: 401

Answers (1)

Saypontigohe
Saypontigohe

Reputation: 311

Sorry, strangely is was way easier than the documentation explained. All I had to do was place a $_SESSION inside my website with information that overrides the config.php file:

$_SESSION['KCFINDER'] = array(
    'disabled' => false,
    'uploadURL' => $_SESSION['upload_dir'],
);

Of course, I put the neccesary protection around this code so only users logged in can use the file browser.

Upvotes: 0

Related Questions