Search code examples
phpsymfonyuploadoneupuploaderbundle

oneup uploader bundle symfony : how to customize endpoint


I'm trying to customize the oneup uploader bundle "endpoint". I know I can specify the folder directly in the form like this :

<form action="{{ oneup_uploader_endpoint('myfolder') }}" class="dropzone">

But how do I change the complete path ? (I need to put it in another website on the same ftp)

(I'm using Dropzone)


Solution

  • As described in the documentation the oneup_uploader_endpoint helper returns a route where the file upload request will be sent and processed, not where the files will be stored. To change the directory you need to configure your mapping accordingly.

    For example:

    oneup_uploader:
        mappings:
            my_mapping:
                frontend: dropzone
                storage:
                    directory: "%kernel.root_dir%/../web/uploads/your-folder"
    

    Afterwards you can use this mapping like this:

    {{ oneup_uploader_endpoint('my_mapping') }}