Introduction
In personal project I am using Symfony v6.3 with:
for upload on client side I have chosen:
Uppy(v3.15.0)
Prerequisites
I need to have 2 separate folders for 2 types of uploads:
- First for regular uploads in the chosen folder (up to 10 files in one go) and
- second for temporary uploads that are used when replacing files one by one (1 file at a time).
I have 2 uploaders uppy_many and uppy_one, both upload to local folder on the server.
The problem
I am setting 2 zones up in config files, but it does not work as i need.
TLDR - only the last declaration in the config is in effect (all uploads go to last declared zone).
I might have a configuration problem or an edge case bug.
The code
relevant part or services.yml
UPPY many (services.yml)
app.upload_many_listener:
class: App\EventListener\UploadManyListener
tags:
- { name: kernel.event_listener, event: oneup_uploader.pre_upload.uppy_many, method: onPreUpload }
- { name: kernel.event_listener, event: oneup_uploader.post_upload.uppy_many, method: onPostUpload }
app.upload_many_validation_listener:
class: App\EventListener\UploadManyValidationListener
tags:
- { name: kernel.event_listener, event: oneup_uploader.validation.uppy_many, method: onValidate }
app.upload_many_unique_namer:
class: App\Uploader\Naming\UploadManyUniqueNamer
public: true
UPPY one (services.yml)
app.upload_one_listener:
class: App\EventListener\UploadOneListener
tags:
- { name: kernel.event_listener, event: oneup_uploader.pre_upload.uppy_one, method: onPreUpload }
- { name: kernel.event_listener, event: oneup_uploader.post_upload.uppy_one, method: onPostUpload }
app.upload_one_validation_listener:
class: App\EventListener\UploadOneValidationListener
tags:
- { name: kernel.event_listener, event: oneup_uploader.validation.uppy_one, method: onValidate }
app.upload_one_unique_namer:
class: App\Uploader\Naming\UploadOneUniqueNamer
public: true
FlySystem (services.yml)
oneup_flysystem.uppy_many_filesystem:
alias: League\Flysystem\Filesystem
public: true
oneup_flysystem.uppy_one_filesystem:
alias: League\Flysystem\Filesystem
public: true
oneup_uploader.yml
oneup_uploader:
mappings:
uppy_many:
frontend: custom
custom_frontend:
class: App\Controller\Uppy\CustomManyUploader
name: uppy_many
storage:
type: flysystem
filesystem: oneup_flysystem.uppy_many_filesystem
enable_progress: true
namer: app.upload_many_unique_namer
uppy_one:
frontend: custom
custom_frontend:
class: App\Controller\Uppy\CustomOneUploader
name: uppy_one
storage:
type: flysystem
filesystem: oneup_flysystem.uppy_one_filesystem
enable_progress: true
namer: app.upload_one_unique_namer
oneup_flysystem.yml
oneup_flysystem:
adapters:
uppy_many_adapter:
local:
location: '%data_dir_stored%'
uppy_one_adapter:
local:
location: '%data_dir_temporary%'
filesystems:
uppy_many_filesystem:
adapter: uppy_many_adapter
alias: League\Flysystem\Filesystem
uppy_one_filesystem:
adapter: uppy_one_adapter
alias: League\Flysystem\Filesystem
# only the last declaration of filesystem takes an effect
# at the moment both uploaders (many and one) upload to `temporary`
P.S.
Please advise, thank you!