(代码修正)OT后台KindEditor编辑器图片上传错误
程序员文章站
2023-12-23 11:07:10
...
代码修正,OT后台KindEditor编辑器图片上传错误.
Addons\EditorForAdmin\Controller\UploadController.class.php
Addons\EditorForAdmin\Controller\UploadController.class.php
/* 上传图片 */
public function upload(){
/* 上传配置 */
$setting = C('EDITOR_UPLOAD');
/* 调用文件上传组件上传文件 */
$this->uploader = new Upload($setting, 'Local');
$info = $this->uploader->upload($_FILES);
return $info ? $info : false;
}
//keditor编辑器上传图片处理
public function ke_upimg(){
/* 返回标准数据 */
$return = array('error' => 0, 'info' => '上传成功', 'data' => '');
$img = $this->upload();
/* 记录附件信息 */
if($img){
$img = $img['imgFile'];
$return['url'] = $this->uploader->__get('rootPath').$img['savepath'].$img['savename'];
unset($return['info'], $return['data']);
} else {
$return['error'] = 1;
$return['message'] = $this->uploader->getError();
}
/* 返回JSON数据 */
exit(json_encode($return));
}
AD:真正免费,域名+虚机+企业邮箱=0元