CKEditor editor when uploading pictures or files is no size limit, let us introduce two ckeditor upload picture file size limit problem resolution.
One can be limited by modifying the php.ini profile upload size, another method can only manually modify the FCKeditor source code, the method is as follows
1, open editor/filemanager/connectors/php directory config.php, create config variable set upload image size, here in kilobytes
1, $Config [' maximagesize ']= ' 1024 ';
2, open the editor/filemanager/connectors/php directory under commands.php, find
The code is as follows |
Copy Code |
if (Isset ($Config [' secureimageuploads '])) { if ($isImageValid = Isimagevalid ($oFile [' Tmp_name '], $sExtension) = = = = False) { $sErrorNumber = ' 202 '; } Upload picture size limit } At the upload picture size limit, add if (Isset ($Config [' maximagesize '])) { $iFileSize = Round ($oFile [' size ']/1024); if ($iFileSize > $Config [' maximagesize ']) { $sErrorNumber = ' 204 '; } }
|
Note: Since PHP calculates the size of the uploaded image in bytes, the code first converts the uploaded image size to KB, and then compares whether the specified image size is exceeded, if the error is exceeded.
Note that the final
The code is as follows |
Copy Code |
if (! $sErrorNumber && isallowedext ($sExtension, $resourceType)) { FCKeditor Upload Image function } Else $sErrorNumber = ' 202 '; |
The Else statement at the end of the code block is removed, otherwise the ability to limit fckeditor upload image file size is not implemented.
3. Open Editor/dialog/fck_image/fck_image.js, add error code (errornumber) information, find onuploadcompleted function, add
The code is as follows |
Copy Code |
Case 204: Alert ("Security error. File size error. ") ; return; |
To this limit fckeditor upload image file Size configuration is complete, other types of upload file size limit is also this way of thinking.
http://www.bkjia.com/PHPjc/632760.html www.bkjia.com true http://www.bkjia.com/PHPjc/632760.html techarticle CKEditor editor when uploading pictures or files is no size limit, let us introduce two ckeditor upload picture file size limit problem resolution. One can pass ...