CKfinder文件上传,不同用户不同文件夹

官网地址:https://ckeditor.com/ckfinder/

  1. 把ckfinder文件夹放入项目中
  2. 指向文件夹中的本地ckfinder.js
  3. 打开authentication
$config['authentication'] = function () {
    return true;
};

  4.如果实现一个用户一个文件夹,打开注释中的root, 用户名对应用户文件夹

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => '/ckfinder/userfiles/',
//  'root'         => '', // Can be used to explicitly set the CKFinder user files directory.
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8',
);
$user = 'local';
$userfiles = '/upload/ckfinder/userfiles/';
session_start();
if (isset($_SESSION["SellerId"]) && !empty($_SESSION["SellerId"])) {
    $user = $_SESSION["SellerId"];
    $userfiles = '/upload/ckfinder'.'/'.$_SESSION["SellerId"].'/';
}

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => $userfiles,
//  'root'         => '', // Can be used to explicitly set the CKFinder user files directory.
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8',
    $user          => $userfiles,
);

 

posted @ 2021-08-04 15:48  变形金刚之猩猩将军  阅读(227)  评论(0)    收藏  举报