1

Here is my code in config.php:

$path = '/laravel/';
require _DIR_.'/../../../../bootstrap/autoload.php';
$app = require_once _DIR_.'/../../../../bootstrap/app.php';

$app->make('Illuminate\Contracts\Http\Kernel')->handle(Illuminate\Http\Request::capture());
$_user = (Auth::check()) ? Auth::user()->username : '';
define('CKFINDER_ROOT_FOLDER', $path.'resources/assets/uploads/'  . $_user .'/');
$config['authentication'] = function () {          
return Auth::check();
};

It works well but I can't upload file (Upload finished with errors). If I remove ->handle(Illuminate\Http\Request::capture() for test, it would run perfectly in this session (not refresh page). Where is my problem. Please help.

thai6070
  • 31
  • 2
  • 7

1 Answers1

1

Issue looks with permission that you need to set 0777 on CKFINDER_ROOT_FOLDER

You may need to add this namespace --

use Illuminate\Support\Facades\File;


$path = '/laravel/';
require _DIR_.'/../../../../bootstrap/autoload.php';
    $app = require_once _DIR_.'/../../../../bootstrap/app.php';

    $app->make('Illuminate\Contracts\Http\Kernel')->handle(Illuminate\Http\Request::capture());
    $_user = (Auth::check()) ? Auth::user()->username : '';

    define('CKFINDER_ROOT_FOLDER', $path.'resources/assets/uploads/'  . $_user);

    if(!File::exists($filePath)) {
        File::makeDirectory(CKFINDER_ROOT_FOLDER, $mode = 0777, true,true);
    }

    $config['authentication'] = function () {          
    return Auth::check();
};
Abhishek
  • 1,543
  • 3
  • 13
  • 29
  • Why did it return: The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.? – thai6070 Apr 22 '16 at 06:39
  • http://ckeditor.com/forums/Support/File-browser-disabled link may give you better idea, issue is now with ckeditor, see the comment by diter98 on this page. – Abhishek Apr 22 '16 at 08:10
  • It seems having problem with laravel. First run, it return user folder but, when use any actions (upload, delete, rename...), Auth::check() return false; So I can't access – thai6070 Apr 22 '16 at 09:23