KindEditor上传大文件,上传错误

时间:2022-08-29 16:55:32

0x00 框架本身文件大小限制

框架JS文件

方法一:配置参数(推荐)

<link rel="stylesheet" href="kindeditor/themes/default/default.css" />
<script charset="utf-8" src="kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="kindeditor/lang/zh-CN.js"></script>
<script>
KindEditor.ready(function(K) {
K.create('#content',{
imageSizeLimit : '10MB', //批量上传图片单张最大容量
imageUploadLimit : 100 //批量上传图片同时上传最多个数
});
});
</script>
<textarea id="content" name="content" style=" width: 99%; height: 500px; visibility: hidden; display: block; "></textarea>

方法二:修改框架kindeditor-all.js文件

imgPath = self.pluginsPath + 'multiimage/images/', //默认上传目录
imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'), //默认上传单个文件大小
imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'), //默认上传类型
imageUploadLimit = K.undef(self.imageUploadLimit, 20), //默认一次性批量上传图片的个数

框架php文件

kindeditor/php/upload_json.php

//最大文件大小
$max_size = 1000000;

0x01 php.ini

1. post_max_size = 50M ; Maximum size of POST data that PHP will accept. 
4. upload_max_filesize = 50M ; Maximum allowed size for uploaded files.

post_max_size,upload_max_filesize都要设置

技巧:注意查看php错误日志