- 
                Notifications
    
You must be signed in to change notification settings  - Fork 347
 
How to allow users to have their own folder
- Create a user.config.php file to set dynamically your folder path with session var, for example.
 
session_start();
$folderPath = '/assets/userfiles/' . $_SESSION['userfoldername'].'/';
$fm = new Filemanager();
$fm->setFileRoot($folderPath);Don't forget to redefined the auth() function, see example below:
function auth() {
   // You can insert your own code over here to check if the user is authorised.
   if(isset($_SESSION['isAllowed'])) return true;
   return false;
}Note that if serverRoot is set to true in "filemanager.config.json". $_SERVER['DOCUMENT_ROOT'] will be added automatically to the given var.
- 
Then, open your "scripts/filemanager.config.json", and make sure the
fileRootis set to '/'; - 
that's all!
 
Note that you may use baseUrl to retrieve the right path to files, see also issue #339.
- 
Go to the file where you are calling the script from and create your user session (unique id or name), and store in a session, eg. $_SESSION['userfoldername']
 - 
Open your connection file, for example: filemanager.config.php and find the line that looks like: $config['doc_root'] = $_SERVER['DOCUMENT_ROOT'] . 'assets/userfiles/user1'; Now, 'user1' should be flexible, so replace above line with something like the following: $config['doc_root'] = $_SERVER['DOCUMENT_ROOT'] . '/assets/userfiles/' . $_SESSION['userfoldername'];
 - 
Then, open your scripts/filemanager.config.js, and make sure the fileRoot looks like: var fileRoot = '/';
 - 
Don't forget to add _start() to filemanager.php!
 - 
that's all!