문제

I am trying to integrate ckfinder with ckeditor. Everything is OK, except one. when I try to upload the image, I get this error (Please check image)

Unable to configure ckfinder with ckeditor

It says "The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file"

Anyone who can help me? Please.

도움이 되었습니까?

해결책

Look in the ckFinder config file, you will see a function like this:

function CheckAuthentication()
{

    return false;
}

By default CheckAuthentication() it is disabled for security reason, because it would allow anyone to upload files to your server.

For testing purposes you can return true but the point is that you implement some logic to only authorize autenticated user.

function CheckAuthentication()
{
    //put some logic here

    return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
}

다른 팁

A simple solution is to force the authentication method using a function that always returns true, using the following code in your config file.

Your Script (for codeigniter):

if(login()){
   set_cookie('ckf_role','admin',2592000*10); // 10 month
}

Top:

        $config['authentication'] = function() {
            return true;
        };

Middle:

    session_start();
    $config['roleSessionVar'] = 'CKFinder_UserRole';
    $_SESSION['CKFinder_UserRole'] = !empty($_COOKIE['ckf_role']) ? strtolower($_COOKIE['ckf_role']) : "guest";

    $config['accessControl'][] = array(
    'role'                => 'guest',
    'resourceType'        => '*',
    'folder'              => '/',
    'FOLDER_VIEW'         => false,
    'FOLDER_CREATE'       => false,
    'FOLDER_RENAME'       => false,
    'FOLDER_DELETE'       => false,
    'FILE_VIEW'           => false,
    'FILE_UPLOAD'         => false,
    'FILE_RENAME'         => false,
    'FILE_DELETE'         => false,
    'IMAGE_RESIZE'        => false,
    'IMAGE_RESIZE_CUSTOM' => false
    );

   $config['accessControl'][] = array(
    'role'                => 'admin',
    'resourceType'        => '*',
    'folder'              => '/',
    'FOLDER_VIEW'         => true,
    'FOLDER_CREATE'       => true,
    'FOLDER_RENAME'       => true,
    'FOLDER_DELETE'       => true,
    'FILE_VIEW'           => true,
    'FILE_UPLOAD'         => true,
    'FILE_RENAME'         => true,
    'FILE_DELETE'         => true,
    'IMAGE_RESIZE'        => true,
    'IMAGE_RESIZE_CUSTOM' => true
    );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top