smallhe 发表于 2013-3-20 11:33:35

官方的kindeditor 例子就是不成功。。

本帖最后由 smallhe 于 2013-3-20 11:39 编辑

提交后老是404.。
官方的kindeditor 例子里面都是在模板里面操作的。。我怎么就是不成功。。发个码。大家看看。

选择Kindeditor就是因为它有多文件上传这点。。

模板 post_add.php



       uploadJson : '../upload_json.php',         fileManagerJson : '../file_manager_json.php',
这两个文件我已经放到跟模板同级根目录了。。





mark35 发表于 2013-3-20 12:48:31

csrf_token ?

amu 发表于 2013-3-20 12:58:35

那两个地址,你应该用框架本身的控制器,方法来做。因为所有的请求都会通过入品进控制器。

所以,“../upload_json.php”这个地址会这样:

假如你当前editor 的地址是:localhost/artilce/add/
那么请求结果就是: localhost/artilce/upload_json.php

你估计一下。localhost/article/upload_json.php,返回是的个啥东西。如果你的控制器里面没有这个。肯定返回404

所以你的editor的设置上传地址应该这样写:/article/upload_json,然后在控制器article里面建一个upload_json的方法。

smallhe 发表于 2013-3-20 14:59:30

amu 发表于 2013-3-20 12:58 static/image/common/back.gif
那两个地址,你应该用框架本身的控制器,方法来做。因为所有的请求都会通过入品进控制器。

所以,“../upl ...

谢谢你了。。

dickfu 发表于 2013-3-20 20:09:23

我在ci下用过kindeditor,的确挺好用的,上传文件是参考示例文件重新写的controller

smallhe 发表于 2013-3-20 22:09:30

我来重新写的controller谢谢。

主要是多文件上传 对我有作用。。

smallhe 发表于 2013-3-20 23:45:50


KindEditor.ready(function(K) {
                                    var editor1 = K.create('textarea', {                                     
                                            items : ['source', 'preview', 'baidumap', 'pagebreak','flash', 'media', 'insertfile', 'insertorderedlist', 'clearhtml', 'quickformat', 'selectall',                               'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                                                     'link', 'unlink','fullscreen'],
                                         uploadJson : '',
                                             fileManagerJson : '',
                                               allowFileManager : true,                                               
                                               afterCreate : function() {
                                                       var self = this;
                                                       K.ctrl(document, 13, function() {
                                                               self.sync();
                                                               K('form').submit();
                                                       });
                                                       K.ctrl(self.edit.doc, 13, function() {
                                                               self.sync();
                                                               K('form').submit();
                                                       });

                                      }
                                       });
                                       prettyPrint();
                       });


如何在controller里面构造js呢?

qq494686707 发表于 2013-4-22 17:57:10

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

可以参考下
页: [1]
查看完整版本: 官方的kindeditor 例子就是不成功。。