可以做如下配置:

CKEDITOR.replace('editor1',{
filebrowserBrowseUrl:'/browser/browse.php',
filebrowserUploadUrl:'/uploader/upload.php'});

It is also possible to set a separate URL for a selected dialog window by using the dialog window name in file browser settings: filebrowserBrowseUrland filebrowserUploadUrl.

CKEDITOR.replace('editor1',{
filebrowserBrowseUrl:'/browser/browse.php',
filebrowserImageBrowseUrl:'/browser/browse.php?type=Images',
filebrowserUploadUrl:'/uploader/upload.php',
filebrowserImageUploadUrl:'/uploader/upload.php?type=Images'});
In the example above, the filebrowserBrowseUrl and filebrowserUploadUrl settings will be used by default. In the Image Properties dialog window CKEditor will use the filebrowserImageBrowseUrl and filebrowserImageUploadUrl configuration settings instead.
在image上传中,会使用filebrowserImageUploadUrl; 传递选择的文件:
To send back the file URL from an external file browser, call CKEDITOR.tools.callFunction and pass CKEditorFuncNum as the first argument:
window.opener.CKEDITOR.tools.callFunction( funcNum, fileUrl [, data]);

If data (the third argument) is a string, it will be displayed by CKEditor. This parameter is usually used to display an error message if a problem occurs during the file upload.

The following code shows how to send back the URL of an uploaded file from the PHP connector:
<?php
// Required: anonymous function reference number as explained above.
$funcNum = $_GET['CKEditorFuncNum'] ;
// Optional: instance name (might be used to load a specific configuration file or anything else).
$CKEditor = $_GET['CKEditor'] ;
// Optional: might be used to provide localized messages.
$langCode = $_GET['langCode'] ; // Check the $_FILES array and save the file. Assign the correct path to a variable ($url).
$url = '/path/to/uploaded/file.ext';
// Usually you will only assign something here if the file could not be uploaded.
$message = ; echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>";
?>

完整的上传图片的代码:

在config设置

filebrowserImageUploadUrl: 'uploadImage.php?type=Images',

uploadImage.php代码如下:

<?php
$url = 'images/uploads/'.time()."_".$_FILES['upload']['name']; /*
$move = @ move_uploaded_file($_FILES['upload']['tmp_name'], $url);
$funcNum = $_GET['CKEditorFuncNum'] ;
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>";
*/
//extensive suitability check before doing anything with the file...
if (($_FILES['upload'] == "none") ||(empty($_FILES['upload']['name'])) )
{
$message = "No file uploaded.";
}
else if ($_FILES['upload']["size"] == 0)
{
$message = "The file is of zero length.";
}
else if (($_FILES['upload']["type"] != "image/pjpeg") && ($_FILES['upload']["type"] != "image/jpeg") && ($_FILES['upload']["type"] != "image/png")&&($_FILES['upload']["type"] != "image/gif"))
{
$message = "图片格式必须是jpg/gif/png";
}
else if (!is_uploaded_file($_FILES['upload']["tmp_name"]))
{
$message = "You may be attempting to hack our server. We're on to you; expect a knock on the door sometime soon.";
}
else {
$message = "";
$move = @ move_uploaded_file($_FILES['upload']['tmp_name'], $url);
if(!$move)
{
$message = "Error moving uploaded file. Check the script is granted Read/Write/Modify permissions.";
}
//$url=$url;
} $funcNum = $_GET['CKEditorFuncNum'] ;
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>";
?>

参考:

http://www.caeus.com/articles/how-to-add-and-upload-an-image-using-ckeditor/

http://www.phpzixue.cn/detail847.shtml

http://blog.csdn.net/xiao__gui/article/details/7684505

http://codeigniter.org.cn/forums/thread-13708-1-1.html

CKEditor 图片上传的更多相关文章

  1. springMVC和ckeditor图片上传

    springMVC和ckeditor图片上传 http://blog.csdn.net/liuchangqing123/article/details/45270977 修正一下路径问题: packa ...

  2. 简单2步实现 asp.net mvc ckeditor 图片上传

    1.打开ckeditor 包下的  config.js,添加一句 配置(PS:ckeditor 很多功能都在该配置文件里配置),如下: config.filebrowserImageUploadUrl ...

  3. .net core CKEditor 图片上传

    最近在玩 asp.net core,不想用UEditor,想使用CKEditor.故需要图片上传功能. 废话不多说,先上效果图: CKEditor 前端代码: <text id="co ...

  4. CKEditor图片上传实现详细步骤(使用Struts 2)

    本人使用的CKEditor版本是3.6.3.CKEditor配置和部署我就不多说. CKEditor的编辑器工具栏中有一项“图片域”,该工具可以贴上图片地址来在文本编辑器中加入图片,但是没有图片上传. ...

  5. CKEditor图片上传问题(默认安装情况下编辑器无法处理图片),通过Base64编码字符串解决

    准备做一个文章内容网站,网页编辑器采用CKEditor,第一次用,默认安装情况下,图片无法插入,提示没有定义上传适配器(adapter),错误码提示如下: 根据提示,在官网看到有两种途径:一使用CKE ...

  6. C# MVC 使用 CKEditor图片上传 提示“不正确的服务器响应”

    重点:看一下你使用的CKEditor版本 过程: 后台需要一款富文本编辑器.经过挑选后,最后选择了FCKEditor 的升级版 CKEditor .在官网下载了4.10.1版本. 经过一番配置后,富文 ...

  7. ckeditor图片上传二三事

    最近实验室要用ckeditor,踩了几个小坑记录下. 1.出现iframe跨域问题 response.setHeader("X-Frame-Options", "SAME ...

  8. 使用struts2完成ckeditor和图片上传

    代码地址如下:http://www.demodashi.com/demo/12427.html 使用struts2完成ckeditor和ckeditor图片上传 ckeditor版本ckeditor_ ...

  9. WINDOW.PARENT.CKEDITOR.TOOLS.CALLFUNCTION 图片上传

    CKEDITOR  编辑器   图片上传 WINDOW.PARENT.CKEDITOR.TOOLS.CALLFUNCTION (CKEditorFuncNum,图片路径,返回信息); CKEditor ...

随机推荐

  1. VS快捷方式小技巧

    VS2005代码编辑器的展开和折叠代码确实很方便和实用.以下是展开代码和折叠代码所用到的快捷键,很常用: Ctrl + M + O: 折叠所有方法 Ctrl + M + M: 折叠或者展开当前方法 C ...

  2. iOS实践01

    去年放假之前大概完成了新浪微博项目,到现在也忘得差不多了,打算在重新写一遍.之前的一些笔记在新浪的博客SleenXiu,在这主要是把新浪微博以随笔的形式写在这,方便以后的复习. 先看看之前主要完成的几 ...

  3. window权限 及c++实现 【网摘】(转)

    from : http://blog.csdn.net/zipper9527/article/details/6256459 http://www.lihuasoft.net/article/show ...

  4. WebApi服务

    WCF 它利用TCP.HTTP.MSMQ等传输协议构建“契约先行”的服务.WCF最初为基于SOAP的服务而设计[xml],繁琐.冗余.慢.沉重 WebApi 基于http协议,轻量级的,支持URL路由 ...

  5. 使用sql语句创建表、修改表、添加列等

    1. 创建表: CREATE TABLE 学生信息 (    学号 varchar(14) IDENTITY(1,1) PRIMARY KEY,    姓名 varchar(8) UNIQUE NOT ...

  6. Django Web开发【6】使用Ajax增强用户体验

    Ajax及其优点 Ajax实际上就是指异步Javascript与XML,它包含以下技术: HTML与CSS Javascript XMLHttpRequest XML Ajax技术让客户端与服务器实现 ...

  7. URL伪静态设置 (apache2.4)

    ` ` 1.修改apche主配置文件 主要是 #LoadModule rewrite_module modules/mod_rewrite.so 改为 LoadModule rewrite_modul ...

  8. java如何引入接口中定义的常量

    接口 (A.java) : package config; public interface A { String PROJECT_ROOT_DIR = System.getProperty(&quo ...

  9. [LeetCode]题解(python):141-Linked List Cycle

    题目来源: https://leetcode.com/problems/linked-list-cycle/ 题意分析: 给定一个链表,判断链表是否有环.要求O(1)空间时间复杂度. 题目思路: 用快 ...

  10. 求1~n直接1出现的次数

    参考前人的统计思想:分别统计个.十.百...亿等第N位上1出现的次数. 如ABCDE,在统计D位1出现的次数时,用D做分割符,ABC为Before,E为After. 分情况考虑:(n为D的length ...