ckeditor+图片上传ckfinder调用和简单配置

function get_editor($name, $value = "", $config = array(), $events = array()){//生成编辑器代码
  include_once(SITE_ROOT. 'editor/ckeditor.php');
  include_once(SITE_ROOT. 'admin/ckfinder/ckfinder.php');
  $ckeditor = new CKEditor();
  $ckeditor->basePath = SITE_URL. '/editor/';
  $ckfinder = new CKFinder();
  $ckfinder->BasePath = '../admin/ckfinder/'; // Note: the BasePath property in the CKFinder class starts with a capital letter.会自动在前面加上/,所以这里不能使用绝对路径
  $ckfinder->SetupCKEditorObject($ckeditor);
  $ckeditor->returnOutput = true;//启用返回代码方式不是直接echo
  return $ckeditor->editor($name, $value, $config, $events);
}

 

 

ckfinder/config.php

function CheckAuthentication()
{//需要修改这里,返回直,就允许操作管理页面

 

    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...

    // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

    // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
    // user logs in your system. To be able to use session variables don't
    // forget to add session_start() at the top of this file.
    return !( empty($_COOKIE['site_code']) || empty($_COOKIE['sitecookie_id']) );//未登录,不允许管理文件,返回false




}

$config['FilesystemEncoding'] = 'gb2312';//系统编码,防止中文文件名乱码

$config['ForceAscii'] = true;//把多字节转成ascii

$baseUrl = './uploads/ckfinder/';//./相对于域名根目录

 

 

上传图片时出现的提示:

由于文件系统的限制该请求不能完成

自动创建的文件夹没有写入的权限,但是修改名字却又能成功;奇怪的现象,没找源码,看了一下配置,已经没有什么可修改了.

手动创建文件夹后却能正常上传

使用xp测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值