CKFinder is not free but in Cakephp you can integrate KCFinder file manager into CKEditor so that you can upload files to your server.
<?php echo $this->Html->script('ckeditor/ckeditor');?>This scipt will include the "webroot/js/ckeditor.js" file to your view.
<?php echo $this->Form->textarea('content',array('class'=>'ckeditor'))?>
Voila! The editor is now displaying instead of raw textarea.
'disabled' => false,But giving everyone access to managing files on the server is probably not a good idea. Instead of this, you can enable file managment only when a specified session variable is set. The name of the session variable is on the bottom of config.php file:
'_sessionVar' => &$_SESSION['KCEDITOR'],So, this is what you should do to make the file manager available after an authenticated user logs in:
$_SESSION['KCEDITOR']['disabled']=false;Remember to destroy this session variable after user logs out.
'uploadURL' => "/app/webroot/upload",If you are developing your application under for example "http://localhost/my_app/" address, the uploadURL should look like:
'uploadURL' => "/my_app/app/webroot/upload",
You can test if KCFinder displays and works correctly under the URL:
Open the "webroot/js/ckeditor/config.js" file and modify editor config to contain following code:
CKEDITOR.editorConfig = function( config )
config.filebrowserBrowseUrl = '/js/kcfinder/browse.php?type=files';
config.filebrowserImageBrowseUrl = '/js/kcfinder/browse.php?type=images';
config.filebrowserFlashBrowseUrl = '/js/kcfinder/browse.php?type=flash';
config.filebrowserUploadUrl = '/js/kcfinder/upload.php?type=files';
config.filebrowserImageUploadUrl = '/js/kcfinder/upload.php?type=images';
config.filebrowserFlashUploadUrl = '/js/kcfinder/upload.php?type=flash';
If your app is being developed under for example http://localhost/my_app/, remember to put the whole path in the URLs, for example:
config.filebrowserBrowseUrl = '/my_app/js/kcfinder/browse.php?type=files';
After adding above six lines of code in the CKEditor configuration you should be able to see "Browse" button in image / link / Flash insert options.