Search code examples
file-uploadckeditor5laravel-10file-manager

how can i Link Flmngr file manager package to upload images and read data from my server


im using Flmngr laravel package for installing ckeditor with file manager but file manager links is on demo server of flmngr how can i change it to my laravel server and read my uploads file from public directory to access all my images my code is like this how should i change that to work?

 ClassicEditor.create( document.querySelector( '#editor' ), {
                    language: 'fa',
        // Flmngr file manager configuration
        // By default it is linked to our demo server.
        // You must change these values to the links to your own server
        // where you will store files and have server PHP side part of Flmngr installed.
        // More info:
        //   https://flmngr.com/doc/install-ckeditor-5-plugin
         Flmngr: {
                        urlFileManager: "http://cms-project.test/admin/flmngr",
                        urlFiles: "/uploads"
        }

        } )
        .then( editor => {
        window.editor = editor;
        } )
        .catch( error => {
        console.error( 'Oops, something went wrong!' );
        console.error( error );
        } );

and here is my route based on flmngr documentation :

    Route::post('/flmngr', function () {
        $dirFiles = public_path('uploads');
        \EdSDK\FlmngrServer\FlmngrServer::flmngrRequest(
            array(
                'dirFiles' => $dirFiles,
            )
        );

    })->name('file-manager');

i turned this sample code from documentation :

  Flmngr: {
            apiKey: "FLMNFLMN",                                  // default free key
            urlFileManager: 'https://fm.flmngr.com/fileManager', // demo server
            urlFiles: 'https://fm.flmngr.com/files',             // demo file storage
        }

to this :

 Flmngr: {
        urlFileManager: "http://cms-project.test/admin/flmngr",
         urlFiles: "/uploads"
}

and expected that file manager read all my image form public/uploads so i can access and select again from that images and upload images to this route public/uploads


Solution

  • It looks like the issue lies in the configuration object name. It should be written in lowercase as flmngr instead of Flmngr. Update your code like this:

    flmngr: {
        urlFileManager: "http://cms-project.test/admin/flmngr",
        urlFiles: "http://cms-project.test/uploads"
    }
    

    This should resolve the issue and allow access to the files.

    I had a similar problem, and changing the configuration object name to lowercase worked for me.