Welcome Guest, Not a member yet? Register   Sign In
Class not found for elFinder(Open-source file manager for web) in Codeigniter 4
#1
Exclamation 

Hi, I'm using elFinder(Open-source file manager for web) in Codeigniter 3, works fine but in Codeigniter 4.1.3 i can not integrate it and show me some error. I am beg someone help or suggestion. Thanks You.

Error Code:
Code:
Class 'App\Libraries\elFinderConnector' not found

My code and configure bellow:

app\Libraries\Elfinder_lib.php

PHP Code:
<?php
namespace App\Libraries;

$root __DIR__.'/../';
include_once 
$root.'ThirdParty/elfinder/elFinderConnector.class.php';
include_once 
$root.'ThirdParty/elfinder/elFinder.class.php';
include_once 
$root.'ThirdParty/elfinder/elFinderVolumeDriver.class.php';
include_once 
$root.'ThirdParty/elfinder/elFinderVolumeLocalFileSystem.class.php';

class 
Elfinder_lib 
{
  public function run($opts) {
        $connector = new elFinderConnector(new elFinder($opts));
        return $connector->run();
    }


app\Controllers\News\FilemanagerController.php

PHP Code:
<?php
namespace App\Controllers\News;

use 
CodeIgniter\Controller;
use 
Config\Services;
use 
App\Libraries\Elfinder_lib;

class 
FilemanagerController extends Controller
{

 
/**
 * Access to current session.
 *
 * @var \CodeIgniter\Session\Session
 */
 
protected $session;

 
/**
 * Authentication settings.
 */
 
protected $config;


    //--------------------------------------------------------------------

 
public function __construct()
 {
 
// start session
 
$this->session Services::session();
 }

 public function 
elfinderInit(){
 
  $opts = array(
 
    // 'debug' => true, 
 
    'roots' => array(
 
      array( 
 
        'driver' => 'LocalFileSystem',
            'path'          => FCPATH '/public/assets/uploads/images',
            'URL'          => base_url('public/assets/uploads/images'),
            'uploadDeny'    => array('all'),// All Mimetypes not allowed to upload
            'uploadAllow'  => array('image''text/plain''application/pdf'),// Mimetype `image` and `text/plain` allowed to upload
            'uploadOrder'  => array('deny''allow'),        // allowed Mimetype `image` and `text/plain` only
            'accessControl' => array($this'elfinderAccess'),// disable and hide dot starting files (OPTIONAL)
 
        // more elFinder options here
 
      )
 
    )
 
  );
 
  $connector = new Elfinder_lib();
 
  $connector->run($opts);
 }



app\Config\Routes.php

PHP Code:
$routes->get('filemanager''News\FilemanagerController::elfinderInit'); 

app\Config\Autoload.php

PHP Code:
public $psr4 = [
 
APP_NAMESPACE => APPPATH// For custom app namespace
 
'Config'      => APPPATH 'Config',
 
'Elfinder'      => APPPATH 'ThirdParty/Elfinder',
 ]; 


elFinder Git link:

https://github.com/Studio-42/elFinder/tree/master/php
Reply


Messages In This Thread
Class not found for elFinder(Open-source file manager for web) in Codeigniter 4 - by mrkzs - 07-28-2021, 05:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB