The uploaded file path is wrong when I use Vich with oneup flysystem. I use the following instruction to generate path:
$videoPath = $this->get('vich_uploader.storage')->resolvePath($video, 'videoFile');
Here is my service configuration:
oneup_flysystem:
adapters:
video_adapter:
local:
directory: '%kernel.root_dir%/../web/e-media-data/video/'
filesystems:
video_file_fs:
adapter: video_adapter
mount: video_file_fs
vich_uploader:
db_driver: orm
storage: flysystem
mappings:
video_file:
uri_prefix: /video
upload_destination: video_file_fs
namer: vich_uploader.namer_uniqid
The generated path does not contain the 'prefix' path specified in the oneup_flysystem adapter, and I get then a FileNotFoundException exception when serving the file.
The file "5a6ae67441c4b194118252.mp4" does not exist
The path is well generated when vich is used without oneup flysystem :
vich_uploader:
db_driver: orm
mappings:
video_mapping:
uri_prefix: /video/
upload_destination: '%kernel.root_dir%/../web/e-media-data/video/'
namer: vich_uploader.namer_uniqid
My vich_uploader for my entity looks like that:
#src/AppBundle/Resources/config/vich_uploader/Entity.Video.yml
AppBundle\Entity\Video:
videoFile:
mapping: video_file
filename_property: videoName
Versions used from my composer.lock file are :
"name": "vich/uploader-bundle",
"version": "1.7.1",
"name": "league/flysystem",
"version": "1.0.41",
I'm afraid that this is the intended behavior, and the prefix is working only for a local filesystem
Same issue Object file has only filename
I have the same issue. There should be at least a notice in this URL, that it won't work when using flysystem.