<div id="editor" style="width:960px;height:500px;">
<script>
var E = window.wangEditor;
var editor = new E('#editor');
editor.customConfig.zIndex = 99;
// 配置服务器端地址
editor.customConfig.uploadImgServer = "/upload.php";
editor.customConfig.uploadImgParams = {//参数
type: 'img'
};
//允许参数
editor.customConfig.uploadImgParamsWithUrl = true;
// 将图片大小限制为 2M(默认5M)
editor.customConfig.uploadImgMaxSize = 2 * 1024 * 1024;
// 限制一次最多上传 5 张图片
editor.customConfig.uploadImgMaxLength = 1;
//自定义filename 名
editor.customConfig.uploadFileName = 'files';
editor.customConfig.uploadImgHooks = {
customInsert: function (insertImg, result, editor) {
var url = result.url
insertImg(url)
}
}
editor.create();
</script>
后端返回数据
批注 2020-05-02 115911.png
后端(PHP) $_FILES 接收数据