我在这里找到了用于移动文件的解决方案 https://knplabs.github.io/Gaufrette/streaming.html
如何在Symfony中使用此代码? 有服务允许复制-移动文件吗?
如果我尝试直接复制
copy('gaufrette://product_uploads/hello.txt', 'gaufrette://product_wasabi/world.txt');
获取
There is no filesystem defined for the "product_uploads" domain.
我在配置中注册
其他示例,我尝试使用配置的适配器而不是文件系统
警告:复制(gaufrette://product_uploads_fs/hello.txt):无法打开流:“ Gaufrette \ StreamWrapper :: stream_open”调用失败
这是我的配置
knp_gaufrette:
stream_wrapper: ~
filesystems:
product_local_fs:
adapter: product_local
product_wasabi_fs:
adapter: product_wasabi
product_wasabi_thumbs_fs:
adapter: product_wasabi_thumbs
product_uploads_fs:
adapter: product_uploads
adapters:
product_local:
local:
directory: '%kernel.project_dir%/public/products'
product_wasabi:
aws_s3:
service_id: 'app_files_s3_wasabi'
bucket_name: 'vp-network'
options:
directory: 'files'
create: true
product_wasabi_thumbs:
aws_s3:
service_id: 'app_files_s3_wasabi'
bucket_name: 'vp-network'
options:
directory: 'thumbs'
create: true
product_uploads:
aws_s3:
service_id: 'app_files_s3_wasabi'
bucket_name: 'vp-uploads'