Codeigniter + Redactor(wysiwyg js editor)。图片上传 [英] Codeigniter + Redactor (wysiwyg js editor). Image uploading

查看:580
本文介绍了Codeigniter + Redactor(wysiwyg js editor)。图片上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Codeigniter网站中集成wysiwyg编辑器Redactor。

I trying to integrate wysiwyg editor Redactor in Codeigniter website.

RedactorOptions:

RedactorOptions:

{
    lang: lang(),
    toolbarFixed: true,
    buttons: ['html', '|', 'bold', 'italic', 'deleted', '|', 'image', 'video', '|', 'unorderedlist', 'orderedlist', '|', 'alignment', '|', 'horizontalrule', '|', 'table', '|', 'mtLink'],
    imageUpload: '/upload_photo'
}

当我开始通过上传图像对话框发送照片,我在开发者控制台中看到:

while I start to send photo through Upload Image Dialog, I see in Developer console:

Uncaught TypeError: Cannot read property '0' of null redactor.js:1
Redactor.(anonymous function).$.(anonymous function).(anonymous function).uploadLoaded redactor.js:1
p.isFunction.f jquery.js:2
p.event.dispatch jquery.js:2
g.handle.h


$ b b

脚本upload_photo正在运行,但$ _FILES为空。

Script "upload_photo" is running, but $_FILES is empty.

出现了什么问题,我该如何解决?

What wrong and how I can to fix it?

提前感谢。

推荐答案

CI的文件上传类将从名为 userfile。 redactor的文件输入字段名为file。因此,您需要在上传脚本中通过将 $ this-> upload-> do_upload()更改为 $ this-> upload-> do_upload('file')

CI's file upload class will look for POST data from input field named 'userfile' by default. The file input field of redactor is named 'file'. So you need to stipulate this name in your upload script by changing $this->upload->do_upload() to $this->upload->do_upload('file').

如果这不是问题,您需要在此处添加上传代码我可以看到发生了什么。

If this isn't the problem you will need to include your upload code here so I can see what's going on.

这篇关于Codeigniter + Redactor(wysiwyg js editor)。图片上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆