如何调用百度编辑器ueditor的上传图片上传文件
Posted killer-leon
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何调用百度编辑器ueditor的上传图片上传文件相关的知识,希望对你有一定的参考价值。
阿里云低价服务器1折特惠,优惠爽翻天,点我立即低价购买
教你如何调用百度编辑器ueditor的上传图片\\上传文件
<
html
>
<
head
>
<
script
src
=
"ueditor/ueditor1.43.config.js"
></
script
>
<
script
src
=
"ueditor/ueditor1.43.all.min.js"
></
script
>
</
head
>
<
body
>
<
script
type
=
"text/plain"
id
=
"j_ueditorupload"
style
=
"height:5px;display:none;"
></
script
>
<
script
>
//实例化编辑器
var o_ueditorupload = UE.getEditor('j_ueditorupload',
autoHeightEnabled:false
);
o_ueditorupload.ready(function ()
o_ueditorupload.hide();//隐藏编辑器
//监听图片上传
o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
alert('这是图片地址:'+arg[0].src);
);
/* 文件上传监听
* 需要在ueditor.all.min.js文件中找到
* d.execCommand("insertHtml",l)
* 之后插入d.fireEvent('afterUpfile',b)
*/
o_ueditorupload.addListener('afterUpfile', function (t, arg)
alert('这是文件地址:'+arg[0].url);
);
);
//弹出图片上传的对话框
function upImage()
var myImage = o_ueditorupload.getDialog("insertimage");
myImage.open();
//弹出文件上传的对话框
function upFiles()
var myFiles = o_ueditorupload.getDialog("attachment");
myFiles.open();
</
script
>
<
button
type
=
"button"
onClick
=
"upImage()"
>调用上传图片模块</
button
>
<
br
>
<
button
type
=
"button"
onClick
=
"upFiles()"
>调用上传文件模块</
button
>
</
body
>
<
html
>
注意:需要在ueditor.all.min.js文件中找到d.execCommand("insertHtml",l)之后插入d.fireEvent('afterUpfile',b)
<
html
>
<
head
>
<
script
src
=
"ueditor/ueditor1.43.config.js"
></
script
>
<
script
src
=
"ueditor/ueditor1.43.all.min.js"
></
script
>
</
head
>
<
body
>
<
script
type
=
"text/plain"
id
=
"j_ueditorupload"
style
=
"height:5px;display:none;"
></
script
>
<
script
>
//实例化编辑器
var o_ueditorupload = UE.getEditor('j_ueditorupload',
autoHeightEnabled:false
);
o_ueditorupload.ready(function ()
o_ueditorupload.hide();//隐藏编辑器
//监听图片上传
o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
alert('这是图片地址:'+arg[0].src);
);
/* 文件上传监听
* 需要在ueditor.all.min.js文件中找到
* d.execCommand("insertHtml",l)
* 之后插入d.fireEvent('afterUpfile',b)
*/
o_ueditorupload.addListener('afterUpfile', function (t, arg)
alert('这是文件地址:'+arg[0].url);
);
);
//弹出图片上传的对话框
function upImage()
var myImage = o_ueditorupload.getDialog("insertimage");
myImage.open();
//弹出文件上传的对话框
function upFiles()
var myFiles = o_ueditorupload.getDialog("attachment");
myFiles.open();
</
script
>
<
button
type
=
"button"
onClick
=
"upImage()"
>调用上传图片模块</
button
>
<
br
>
<
button
type
=
"button"
onClick
=
"upFiles()"
>调用上传文件模块</
button
>
</
body
>
<
html
>
注意:需要在ueditor.all.min.js文件中找到d.execCommand("insertHtml",l)之后插入d.fireEvent('afterUpfile',b)
阿里云低价服务器1折特惠,优惠爽翻天,点我立即低价购买
以上是关于如何调用百度编辑器ueditor的上传图片上传文件的主要内容,如果未能解决你的问题,请参考以下文章
怎么修改百度编辑器(Ueditor)的上传图片大小限制,PHP版的
百度 Ueditor 在线编辑器 无法上传图片或者文件 提示上传错误