Multiple storage folders

Hi,

I’d love to know if there’s a way to somehow specify the storage folder to be used on a per request basis.

My goal is to enable multiple site contents to be managed with a single Cockpit installation. Ideally, depending on the URL used to get to cockpit, I’d like to point to a different storage dir.

I once had the exact same intention and also tried hard to implement a chance of having multiple storage dirs.

Lately after (unsuccessfully) trying around I came up with another approach that results in the exact same result:

Install this and create groups for every customer within the one cockpit installation.

This addons makes all users only see assets uploaded by their own group.

The result is completely the same as you desire it - but there will still be just one storage dir.

One option can be to create a file named defines.php in the cockpit root folder.

This file will always be auto-loaded before cockpits initialization.

In that file you can set the constant COCKPIT_STORAGE_FOLDER based on $_SERVER['SERVER_NAME']

FYI:


Greets
Artur

Thank you both for your input. Right now I’m experimenting with COCKPIT_STORAGE_FOLDER in defines.php , and looks promising.

One thing I had to do though that’s worth noting is changing the value of the session.name config, otherwise logged users could use their own session to access another storage.

I just hope that having many concurrent users accessing different storage directories doesn’t cause any problems due to the amount of open files, that’s something I’ll need to test.

Hello !
Please, can we have a concret example of the defines.php thing ?
I realy need storage folder based on user but don’t know how to implement that.