Vichuploaderbundle: Wrong path file with oneup flysystem

Created on 26 Jan 2018  路  3Comments  路  Source: dustin10/VichUploaderBundle

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",
Support

All 3 comments

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.

https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/downloads/serving_files_with_a_controller.md

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seddighi78 picture seddighi78  路  4Comments

nobady90 picture nobady90  路  3Comments

jcg678 picture jcg678  路  6Comments

ngilain picture ngilain  路  5Comments

andrea-daru picture andrea-daru  路  3Comments