You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are 2 configuration options which affects the location of a storage folder of user files:
serverRoot (bool)
fileRoot (bool|string)
By combining values of these options you can change target location of storage folder.
serverRoot - "carview.php?tsp=true" by default, means that storage folder location is defined relative to the server document root folder.
Set value to "false" in case the storage folder of user files is located outside server root folder.
If fileRoot options is set to "false", serverRoot value is ignored - always "carview.php?tsp=true".
fileRoot - "false" by default, means that storage folder is located under server document root folder and named "userfiles".
You can set specific path to the storage folder of user files instead of "false" value with the following rules:
absolute path in case serverRoot set to "false", e.g. "/var/www/html/filemanager/userfiles/"
relative path in case serverRoot set to "carview.php?tsp=true", e.g. "/filemanager/userfiles/"
You could change the options values as it's described in the Configuration section in two ways:
$local = new \RFM\Repository\Local\Storage();
$local->setRoot('user_folder', true, true);
Parameters of the setRoot method are as follows:
Relative or absolute path to folder (see examples below)
whether to create folder if it does not exist
same as "serverRoot" configuration option
Local storage folder setup examples
Default case - user folder located inside the RichFilemanager root folder
The default user folder is named "userfiles" and located inside the RichFilemanager root folder.
After the application is deployed it should automatically detect the "userfiles" folder location,
so you don't need to make any changes in configuration options, which looks as follows by default:
"serverRoot" => true,
"fileRoot" => false,
Specify user folder located UNDER server document root folder
Setup configuration options
"serverRoot" => true,
"fileRoot" => "/filemanager/files/", // relative path to a storage folder of user files
IMPORTANT: If a storage folder of user files is located outside server document root folder, then the application is unable to define absolute URL to user files.
RichFilemanager still able to preview the files, but by reading them via connector URL instead of using absolute URL.
This may cause problems in case integration RichFilemanager with WYSIWYG editors.
Luckily in most cases it's possible to specify URL to access storage folder explicitly.
See Handle preview URL RichFilemanager wiki article for the details.
Setting dynamic user folder based on session
This example shows how to set storage folder path dynamically based on session variable.
session_start();
// supposed that user folder name is stored in "userfolder" session variable$folderPath = "/filemanager/files/" . $_SESSION["userfolder"];
$app = new \RFM\Application();
$local = new \RFM\Repository\Local\Storage();
// example to setup files root folder$local->setRoot($folderPath, true, true);
$app->setStorage($local);
// set application API$app->api = newRFM\Api\LocalApi();
$app->run();
AWS S3 storage folder
Since AWS S3 storage root folder depends on your S3 bucket configuration you are only able to change user folder under the bucket.
Use "setRoot" storage method:
$s3 = new \RFM\Repository\S3\Storage();
$s3->setRoot('user_folder', true);
Parameters of the setRoot method are as follows:
Relative path to S3 storage "folder" under the bucket.