Search code examples
symfonyelfinder

Upload file type with FMElfinder browser on symfony


I have successfully integrated FMElfinderBundle with IvoryCkeditor. Thanks to provider.

Now, I am looking for to upload the files for <input type="file"> from the same elfinder browser through symfony as,

$builder->add('file', 'file');

Is it possible to upload file from Elfinder file browser for this case?

Updates:

My config for elfinder looks like this,

fm_elfinder:
    instances:
        default:
            locale: %locale% # defaults to current request locale
            editor: ckeditor # other options are tinymce, tinymce4, form, custom and simple
            fullscreen: true # defaults true, applies to simple and ckeditor editors
            theme: smoothness # jquery theme
            include_assets: true # disable if you want to handle loading of the javascript and css assets yourself
            connector:
                debug: false # defaults to false
                roots:       # at least one root must be defined
                    uploads:
                        show_hidden: false # defaults to false
                        driver: LocalFileSystem
                        path: uploads
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 2M
        form:
            locale: %locale% # defaults to current request locale
            editor: form # other choices are tinymce or simple, and form
            fullscreen: true # defaults true, applies to simple and ckeditor editors
            include_assets: true # disable if you want to handle loading of the javascript and css assets yourself
            connector:
                debug: false # defaults to false
                roots:       # at least one root must be defined
                    uploads:
                        driver: LocalFileSystem
                        path: uploads
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 2M

and on my form type for elfinder form type,

->add('image','elfinder', array('instance'=>'form', 'enable'=>true))

What I get on my output is just a text field with no popup on clicks, what's the issue?


Solution

  • Bundle provides it's own form type for this cases. Elfinder form type, btw usage of input file type, in my opinion assumes that you will handle file uploading process by your own controller