Search code examples
codeigniterckeditorckfinder

How to change upload directory path of ckfinder in codeigniter


I have integrated ckfinder 3 for php and after uploading images, getting the directory of uploaded images in the root, not in my project directory but I need inside my project directory like project/upload/ckfinder/userfiles

I am trying as follows in the ckfinder/config.php file of ckfinder:

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => base_url().'upload/ckfinder/userfiles/',
    //'root'         => '', // Can be used to explicitly set the CKFinder user files directory.
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8',
);

But It is not working
Please help me. Thanks in advance


Solution

  • baseUrl is optional for setting the backend and root is required.

    If "project" is the folder where the CodeIgniter file index.php is found then use this backend

    $config['backends'][] = array(
         'name'               => 'default',
         'adapter'            => 'local',
          //'baseUrl'            => '',
         'root'               => FCPATH .'upload/ckfinder/userfiles/',
         'chmodFiles'         => 0755,
         'chmodFolders'       => 0755,
         'filesystemEncoding' => 'UTF-8',
         'followSymlinks'     => true
     );