dongqi3533 2018-06-18 12:46
浏览 79

KCfinder如何使用GLOBAL变量

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:

  • user logs in and gets a $_SESSION['upload_key']
  • user wants to upload an image, and since he is logged in, the upload directory will be changed into the upload_key: 'uploadURL' => /myuploadkey

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

All help is appreciated! :)

  • 写回答

1条回答 默认 最新

  • dongxu6418 2018-06-18 12:57
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题