RSS

Integrating Ckfinder plugin in CkEditor

25 Mar

Ckfinder plugin is a ajax file manager for the html editor like ckeditor. It is a popular plugin for uploading your files. Right now ckedior’s file uploader doesnt work fine. So you can use ckfinder for file uploading purpose.

It can be used for free. But if you want to use a licensed version  that is also possible. For this all you need to go to their home page and order for a license.

Step-1:

Download ck-finder from their home page.

Step-2:

Unzip the file and Keep ckfinder and ckeditor in the same directory.

Step-3:

To load the file uploader/browse server button in  ck-editor we just need to link up the ckfinder.js file as well as ckeditor.js file in the view file. Then put the following codes in the view file and the configure file.

a) Codes to be inserted in your view file :

<?php
     echo $javascript->link('/ckeditor/ckeditor'); //Link the ckeditor.js file on the page you want to use the editor.
     echo $javascript->link('/ckefinder/ckfinder'); //Link the ckfinder.js file on the page you want to use the editor.?>
<?php
    echo $form->textarea('content', array('id'=>'content','class'=>'ckeditor'));
?>
// we should Place this script after the textrea loads.
<script type="text/javascript">

     var ck_newsContent = CKEDITOR.replace( 'content' ); //the textarea id is given here to override the editor uploader with ckfinder.
     CKFinder.SetupCKEditor( ck_newsContent, 'ckfinder/') ;

</script>

b) Codes to be edited in the config.php file of ckfinder folder.


function CheckAuthentication()
{
   // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
   //return false;

   return true;
}

$baseUrl = 'http://localhost/bidesh/system/webroot/js/ckfinder/userfiles/';

$baseDir = 'D:\wamp/www/bidesh/system/webroot/js/ckfinder/userfiles/';

Thats it…. :)

Advertisement
 

About milansaha

Web Developer
20 Comments

Posted by on March 25, 2010 in CakePhp

 

20 Responses to Integrating Ckfinder plugin in CkEditor

  1. Grzesiek

    May 23, 2010 at 12:10 pm

    Hi,

    You can also try free PGRFileManager, http://pgrfilemanager.sourceforge.net

    Cheers, Grzesiek

     
  2. Munish

    July 17, 2010 at 8:10 am

    Hi Milan. I am integrating ckefinder in cakephp. I tried every written above but still no success. Not able to see upload button in ckeditor. Can you please help me in this.

     
    • Milan

      July 18, 2010 at 4:34 am

      Hello….can u check if the JavaScript files are properly linked to the view files? Then the upload file should come. Make sure no js error is occurred in browser. If u use firefox then error console can help u to identify this problem.

       
  3. siddharth

    February 9, 2011 at 6:26 am

    hi,

    ckfinder is showing system error.can you please help me.

    I am planning to take http://siddharthjindal.net

    what should be the $baseUrl and $baseDir ?

    thanks

     
  4. Martin B.

    February 13, 2011 at 5:35 pm

    This is so bad!
    What is $baseUrl and $baseDir?
    The view file? Not quite specific!!!

    Best regards!

     
    • milansaha

      February 13, 2011 at 6:10 pm

      Well,
      $baseUrl = ‘http://localhost/bidesh/system/webroot/js/ckfinder/userfiles/’;
      Here $baseUrl is the url for the target folder where uploaded files will be kept in. In the above example the folder is ‘userfiles’ and this folder be writable (777).

      $baseDir is the actual path for that folder or directory.

       
  5. Klaus Jacobsen

    April 11, 2011 at 5:56 pm

    Du skriver:
    a) Codes to be inserted in your view file :

    Jeg forstå ikke hvilken fil ( “view file”) det er?

     
    • Klaus Jacobsen

      April 11, 2011 at 5:59 pm

      Sorry that I wrote in Danish, here it is in English.:

      You write:
      a) Codes to be inserted in your view file:

      I understand not what file (“view file”) it is?

       
      • Milan Saha

        April 11, 2011 at 6:11 pm

        If you use cakephp then file is where is html codes are written.Usually it is told view file of MVC framework. If you are not clear yet you can email me or ask me in messenger.
        Contact details are given in about me page of this blog.

         
  6. Klaus Jacobsen

    April 11, 2011 at 8:07 pm

    Hello again
    Thanks for the quick reply.
    Think maybe I need a little more “help “. So maybe write you a mail tomorrow.
    … do you think that you have experience with WordPress?

     
    • Milan Saha

      April 12, 2011 at 3:56 am

      Allright !
      Yap, I worked in word-press too.

       
  7. Paulys

    May 23, 2011 at 5:13 pm

    Hi! I need help. I use WordPress and “CKEditor for WordPress” plugin.
    I want to add CKFinder, but I don’t understand how do it.
    I load de CKeditor in frontpage:

    window.onload = function()
    {
    CKEDITOR.replace( ‘id-textarea’ );

    };

    Works good, but I need de CKFinder in the editor

     
    • Milan saha

      May 24, 2011 at 10:41 am

      I have given the detail info in this post. Still if u face any problem, pls let me know the exact problem you are facing here.
      U can also mail me if i can help you regarding this.

       
      • Paulys

        May 24, 2011 at 5:22 pm

        Hi! thanks for the reply! I solved the problem.
        Paula.

         
  8. Matt

    May 25, 2011 at 12:11 am

    Hi Milan

    I have setup as directed above, but ckfinder upload options are not displaying.

    $baseUrl = ‘http://localhost/YMCA/ynet/ckfinder/userfiles/’;
    $baseDir = ‘/Applications/XAMPP/xamppfiles/htdocs/YMCA/ynet/ckfinder/userfiles/’;

    var editor = CKEDITOR.replace(‘pagecontent’);
    CKFinder.SetupCKEditor( editor, ‘ckfinder/’ ) ;

    I have tried another way including:

    CKEDITOR.replace( ‘pagecontent’,
    {
    filebrowserBrowseUrl : ‘/ckfinder/ckfinder.html’,
    filebrowserUploadUrl : ‘/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files’,

    filebrowserImageBrowseUrl : ‘/ckfinder/ckfinder.html?type=Images’,
    filebrowserFlashBrowseUrl : ‘/ckfinder/ckfinder.html?type=Flash’,

    filebrowserImageUploadUrl : ‘/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images’,
    filebrowserFlashUploadUrl : ‘/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash’,

    filebrowserWindowWidth : ’600′,
    filebrowserWindowHeight : ’600′
    });

    This way, I can get the ckfinder to display, but then I get can’t find folder error.

    Do you have any suggestions on either of these methods?

    Thanks in advance.

    Matt

     
    • Milan

      May 25, 2011 at 3:16 am

      Well,

      I guess following things should be given properly in this case. Please give the full path like below.

      $baseDir = ‘D:\wamp/www/bidesh/system/webroot/js/ckfinder/userfiles/’;

       
      • Matt

        May 25, 2011 at 3:28 am

        Thanks Milan

        I have updated to :

        $baseDir = ‘/MacHD/Applications/XAMPP/xamppfiles/htdocs/YMCA/ynet/ckfinder/userfiles/’;

        No luck yet.

        Cheers.

        Matt

         
  9. I

    October 23, 2011 at 12:23 am

    Hi and thanks for nothing. It doesn’t work. I think i’m at 6 exemple that i try it … :( ((

     
    • Milan Kumar Saha

      October 23, 2011 at 4:15 am

      Can you pls send your codes. I got it working. I will try if i can put some more hints?

       
  10. Roger

    November 15, 2011 at 1:56 pm

    Why cant i get it to work?

    The view file, is that the “page” where i use the CKeditor?
    Does it matter where i paste the text on that page?

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.