您的位置:首页 > 编程语言 > PHP开发

PHP通过kindeditor上传文件失败的扩展思考。

2016-07-09 11:16 706 查看
场景描述:

用的富文本编辑:kindeditor,其中有个上传图片的功能。

var options = {
uploadJson : '/admin/upload/doupload',
fileManagerJson : '/edit/file_manager_json.php',
allowFileManager : false,
filterMode : true
};

KindEditor.ready(function(K) {
window.editor = K.create('#editor_id',options);
});


kindeditor选择图片后点击上传,直接提示错误,但是没有显示错误的原因。。。。找错误的原因半天没找到,囧,没开PHP的error_log。。。。。。

打开error_log后发现:

[09-Jul-2016 02:27:30 UTC] PHP Warning:  POST Content-Length of 18107144 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
[09-Jul-2016 02:27:58 UTC] PHP Warning:  POST Content-Length of 18107144 bytes exceeds the limit of 8388608 bytes in Unknown on line 0


找到错误原因后,各种简单了。。。

post_max_size = 50M ; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
upload_max_filesize = 50M ; Maximum allowed size for uploaded files.


然后再上传的时候,收到错误提示图片大小太大,去修改上传图片的后台代码就OK了。。。。

东西虽简单,但是错误排除很蛋疼。。。。

以后注意了,各种日志能打开就打开吧,尤其是开发环境下。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: