Pergunta

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.

Foi útil?

Solução

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'];
}

Outras dicas

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
    );
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top