1. 程式人生 > >KindEditor上傳大檔案,上傳錯誤

KindEditor上傳大檔案,上傳錯誤

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錯誤日誌