码迷,mamicode.com
首页 > 其他好文 > 详细

UEditor 编辑器常见问题解决

时间:2020-06-24 16:03:10      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:insert   open   list   涂鸦   awl   pre   http   lap   state   

ueditor单图上传图片显示上传错误/多图上传显示服务器错误,实际上图片已经传到服务器或者本地

1、这个问题是因为ueditor里面的Upload.class.php里面__construct()方法里面的iconv函数有问题

/*$this->stateMap[‘ERROR_TYPE_NOT_ALLOWED‘] = iconv(‘unicode‘, ‘utf-8‘, $this->stateMap[‘ERROR_TYPE_NOT_ALLOWED‘]);*/
$this->stateMap[‘ERROR_TYPE_NOT_ALLOWED‘] = mb_convert_encoding($this->stateMap[‘ERROR_TYPE_NOT_ALLOWED‘], ‘utf-8‘, ‘auto‘);

2、config.json 文件配置: imageUrlPrefix ,一般配置访问域名

 

请求后台http 配置错误,上传功能不能正常使用

1、ueditor.config.js

 //   var URL = window.UEDITOR_HOME_URL || getUEBasePath();
var URL =window.location.protocol+"//"+window.location.host; // 协议+域名,这里是80默认端口,如果是其他建议加上端口号

//为编辑器实例添加一个路径,这个不能被注释
UEDITOR_HOME_URL: ‘/ueditor/‘,// 静态文件路径

// 服务器统一请求接口路径
serverUrl: URL + "/plugin/EditorUpfile/requestUp",

2、config.json

*UrlPrefix=协议+域名+端口号 // 如果是80,可以不写
*PathFormat=> "/ueditor/upload/image/{yyyy}{mm}/{time}{rand:6}", /* 相对于域名上传保存路径,可以自定义保存路径和文件名格式 */

 

后端配置项没有正常加载,上传插件不能正常使用!

提示  errorHandler 未定义,在调用的前面添加

var errorHandler;
errorHandler = function(title) {
    var loader = me.document.getElementById(loadingId);
    loader && domUtils.remove(loader);
    me.fireEvent(‘showmessage‘, {
        ‘id‘: loadingId,
        ‘content‘: title,
        ‘type‘: ‘error‘,
        ‘timeout‘: 5000
    });
};

 

如果原型中定义了  showErrorLoader,可以直接调用 showErrorLoader。

 

可以测试一下 php 代码是否正确执行,在浏览器打开 ueditor/controller.php 对应的路径,看看是有配置值返回(json 格式)

技术图片
{"imageActionName":"uploadimage","imageFieldName":"upfile","imageMaxSize":10485760,"imageAllowFiles":[".jpeg",".jpg",".png",".gif"],"imageCompressEnable":true,"imageCompressBorder":1600,"imageInsertAlign":"none","imageUrlPrefix":"http:\/\/tp.com\/","imagePathFormat":"\/ueditor\/upload\/image\/{yyyy}{mm}\/{time}{rand:6}","scrawlActionName":"uploadscrawl","scrawlFieldName":"upfile","scrawlPathFormat":"\/ueditor\/upload\/image\/{yyyy}{mm}\/{time}{rand:6}","scrawlMaxSize":2048000,"scrawlUrlPrefix":"","scrawlInsertAlign":"none","snapscreenActionName":"uploadimage","snapscreenPathFormat":"\/ueditor\/upload\/image\/{yyyy}{mm}\/{time}{rand:6}","snapscreenUrlPrefix":"","snapscreenInsertAlign":"none","catcherLocalDomain":["127.0.0.1","localhost","img.baidu.com"],"catcherActionName":"catchimage","catcherFieldName":"source","catcherPathFormat":"\/ueditor\/upload\/image\/{yyyy}{mm}\/{time}{rand:6}","catcherUrlPrefix":"","catcherMaxSize":2048000,"catcherAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"videoActionName":"uploadvideo","videoFieldName":"upfile","videoPathFormat":"\/ueditor\/upload\/video\/{yyyy}{mm}\/{time}{rand:6}","videoUrlPrefix":"","videoMaxSize":104857600,"videoAllowFiles":[".avi",".mov",".wav",".mp4",".mp3"],"fileActionName":"uploadfile","fileFieldName":"upfile","filePathFormat":"\/ueditor\/upload\/file\/{yyyy}{mm}\/{time}{rand:6}","fileUrlPrefix":"http:\/\/tp.com","fileMaxSize":52428800,"fileAllowFiles":[".txt",".doc",". docx",". xls",". xlsx",". ppt",".htm",".html",".zip",".rar",".gz",".bz2",".pdf"],"imageManagerActionName":"listimage","imageManagerListPath":"\/ueditor\/upload\/image\/","imageManagerListSize":20,"imageManagerUrlPrefix":"","imageManagerInsertAlign":"none","imageManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"fileManagerActionName":"listfile","fileManagerListPath":"\/ueditor\/upload\/file\/","fileManagerUrlPrefix":"","fileManagerListSize":20,"fileManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp",".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid",".rar",".zip",".tar",".gz",".7z",".bz2",".cab",".iso",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".txt",".md",".xml"]}
View Code

 

涂鸦提示糟糕,读取图片失败

需要在config.json 中添加 

"scrawlAllowFiles":[".png", ".jpg", ".jpeg", ".gif", ".bmp"]/* 图片格式 */

 

UEditor 编辑器常见问题解决

标签:insert   open   list   涂鸦   awl   pre   http   lap   state   

原文地址:https://www.cnblogs.com/xuey/p/13182375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!