D
D
Dmitry Kim2020-02-04 14:18:05
symfony
Dmitry Kim, 2020-02-04 14:18:05

How to use ElfinderType in Symfony to select an image file?

There is a form, it has a field with an image, where ElfinderType is used.

->add('image', ElFinderType::class, [
    'attr' => ['class' => 'form-control', 'readonly' => 'readonly'],
])

Clicking on this field opens Elfinder to select a file.
How can I close the Elfinder window by double clicking on the selected file and insert the path to the file in this field in the form?

PS: When using CKEditor + Elfinder, when double-clicking, the image is successfully inserted into the text.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2020-02-04
@kimono

Issue resolved. You need to create a second instance:

fm_elfinder:
    fileinput:
        editor: form

->add('image', ElFinderType::class, [
    'attr' => ['class' => 'form-control', 'readonly' => 'readonly'],
    'instance' => 'fileinput'
])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question