In my Symfony 6 project I need to store big uploaded files per user session.
As it's not a good idea to directly store these files in the session I'm using flysystem with a directory per session id and a cleanup process.
So far so good
Now as I don't want generate the file path per session id every time I want to directly configure a flysystem storage as service using the current session id as base directory like this:
flysystem:
storages:
session.storage:
adapter: 'local'
options:
directory: '%env(APP_SESSION_STORAGE_PATH)%/%sessionId%'
This obviously does not work as there is no %sessionId%
but how can I do this?
I also tried to use a factory but this also feels to be over complicated as I would have to copy the logic from flysystem-bundle
to initialize this service.
I know this service only works within http context.
Just the code-idea. Just after your "..have to copy the logic from flysystem-bundle..". Wow. I think you try to make it over complicated
I don't know your app-logic. However just like:
Your service :
Then inject this service where U need it.