Using ElFinder on Symfony

I want to use ElFinder as my file manager in my Symfony project. I followed the doc on GitHub. In my routes.yaml:

     resource: '@FMElfinderBundle/Resources/config/routing.yaml'


- { path: ^/efconnect, role: [ROLE_USER] }
- { path: ^/elfinder, role: [ROLE_USER] }

And finally on fm_elfinder.yaml

            locale: '%locale%' # defaults to current request locale
            editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom
                        driver: LocalFileSystem
                        path: uploads
                        upload_max_size: 2M

Then I added it on a Admin element on Sonata, like this:
protected function configureFormFields(FormMapper $formMapper)

        ->add('published', CheckboxType::class, ['required' => false, 'label' => 'Publier'])
        ->add('title', TextType::class, ['required' => true, 'label' => 'Titre'])
        ->add('textLink', TextType::class, ['required' => true, 'label' => 'Texte du lien'])
        ->add('media', ElFinderType::class, array(
            'label' => 'Photo',
            'enable' => true,
            'required' => true,
            'instance' => 'default',
            'attr' => array('class' => 'form-control')

Then I go on Sonata Admin, and when I try to add an image, a window open itself and I get an error which is triggered in another Controller of my project, but it has nothing to do with the entity I’m trying to create. I have litterally no idea why this controller is called, and so I can’t add an image because this error is triggered. Does anyone have an idea
why a controller would be called when I’m trying to add an image via ElFinder? Or did I forgot to add something to my project?
Thanks for your help.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *