ziben69's avatar

Laravel 5.8 CKEditor CKFinder - custom path to upload directory

Hello guys, how can I change path to custom directory. I found path in file: vendor/ckfinder/ckfinder-laravel-package/src/config.php:

$config['backends']['default'] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => config('app.url').'/userfiles/',
    'root'         => public_path('/userfiles/'),
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8'
);

but when I change the path, nothing happens. Then the files are saved in the wrong place. I put in a static path and nothing. Can upload to this path (example.com/userfiles/files/test.png), but my file is shown on a different path: (example.com/template/public/userfiles/files/test.png). Part of path is missing: (.../template /public/...) This is because I have a directory structure different from the standard one. I have the files in the public directory higher, and the rest in the custom directory. Swapped places. Does anyone have any idea where I can configure the path to display the images?

0 likes
6 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Did you follow the guide to get the config file into your own config directory? Change it in there after publishing it

php artisan vendor:publish --tag=ckfinder

My guess is that the file will be named ckfinder.php and be located in /config

1 like
ziben69's avatar

After publication, it only published the /public directory of ckfinder. The path can be changed in the /src directory, which is at the same level as the public directory (config is in /src/config.php).

Sinnbeck's avatar

@ziben69 when you say

config is in /src/config.php

Are you talking about the vendor directory? If so, go back and look at the config directory of your own app

Never change files in the vendor directory

1 like
ziben69's avatar

@Sinnbeck yes i am talking about vendor directory. It only published the /public directory from vendor, and in the vendor directory there is also a /src directory where the ckfinder configuration file is located. It has not been published.

It is actually in the config directory of my application. Oki we test

ziben69's avatar

A hint for others:

  1. publish vendor from documentation: https://github.com/ckfinder/ckfinder-laravel-package
  2. Go via FTP to path config/ckfinder.php
  3. Change baseUrl to custom URL
// Backends

$config['backends']['default'] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => config('app.url').'/custom_path/userfiles/',
    'root'         => public_path('/userfiles/'),
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8'
);

Please or to participate in this conversation.