Search code examples
symfonyelfinder

FMElfinderBundle 5 - how to set temp folder for upload


I am using FMElfinderBundle v.5 (for some reasons I cannot use latest version) with Symfony 2.8.12. I followed documentation and it worked fine, until there was request to allow upload large files (up to 20MB). I changed upload_max_size parameter to 20M and it was ok, but during upload files are split to 2MB chunks and elfinder tries to store them in temp directory. Problem is, that it has no access there. It does not read settings from virtual host definition, it always uses system temp folder.

Reading documentation I have found that there can be used two parameters for configuring elfinder temp dir - upload_temp_path and common_temp_path. But i didn't have luck with setting them. Every time I run in PHPStorm console command s cache: clear --no-warmup I get InvalidConfigurationException.

I tried to put parameters somewhere else in config structure under fm_elfinder key, but still the same exception.

This is my configuration in config.yml:


    fm_elfinder:
        instances:
            default:
                locale: %locale%
                editor: ckeditor
                fullscreen: true
                theme: smoothness
                include_assets: true
                relative_path: false
                connector:
                    roots:
                        uploads:
                            driver: LocalFileSystem
                            path: uploads
                            upload_max_size: 20M

Anyone please can help me, how to set temp dir?


Solution

  • Ok, i have found solution. It is necessary to make yoour own custom configuration reader and replace the original one. Configuration class must implement ElFinderConfigurationProviderInterface. See [https://github.com/helios-ag/FMElfinderBundle/blob/master/Resources/doc/advanced-configuration.md#custom-configuration-provider][1] for more details.