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 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制