CKfinder for cakephp 3


#1

Hello
i appreciate it if you can help me
i want to implement ckeditor and ckfinder in my cakephp 3 app.
so i used the following code in my view

<?php echo $this->Form->control('body',['type' => 'textarea','id'=>'myeditor','name' => 'myeditor','class'=>'myeditor', 'escape' => 'true', 'rows' => '8', 'cols' => '31','label'=>'متن:','Enter'=>'true']);?>

and also the following script is in my view

var editor = CKEDITOR.replace( ‘myeditor’,
{
customConfig: ‘custom/editor_custom_config.js’

});
CKFinder.setupCKEditor(editor, ‘/ckfinder/’);

ckfinder and ckeditor are in adjacent folders in webroot/js.
the editor comes in the view but when i click on image to upload an image ckfinder comes up which has some fields URL and other fields and a button named “Browse server” right beside the “URL filed” and also an “upload” tab. the problem is when i click on “upload” or “Browse server” it does not work and a page comes up that displays nothing but a button named OK.

maybe i worked wrong to set ‘baseUrl’ and ‘baseDir’ in config.php of ckfinder.
right now it’s like the follow but i tried everything i thought and it did not worked.
‘baseUrl’ => ‘http://www.mysite.ir/js/ckfinder/’,
‘baseDir’ => ’ ',

i set the following session and authentication like this right next to <?php in config.php
session_name(“CAKEPHP”);

session_start();

function CheckAuthentication()

{

if( isset($_SESSION[‘Auth’][‘User’]) )

{

return false;

}

return true;

}

and also i set .htaccess for that
RewriteRule ^ckfinder/ - [L]

i really appreciate your help


#2

you need to configure the path of ckeditor file upload handler.

here’s the basic configuration code that can be used to insert a CKEditor instance with the file browser configured. (copied from documentation).

CKEDITOR.replace( ‘editor1’,
{
filebrowserBrowseUrl : ‘/browser/browse.php’, // File browser handler
filebrowserUploadUrl : ‘/uploader/upload.php’ // File Upload Handler
});

you may refer here for more in detail:
Go To Documentation