我在拉维尔有两个磁盘.

One is the local disk, the other one is a FTP server which I need to upload my files to. They are both correctly configured.

I have attempted it this way:

 Storage::disk('FTP')->copy('old/file1.jpg', 'new/file1.jpg');

This would only copy the file if it is already in the FTP server. I have also read the documentation and there seems to be no way to combine both in order to upload files.

Any suggestions?

推荐答案

A simple combination of Storage::get and Storage::put should do the trick.

Storage::disk('FTP')->put('new/file1.jpg', Storage::get('old/file1.jpg'));

Laravel相关问答推荐

Laravel:如何从不断更新的Controller中分页数据

使用MAATWebSite/EXCEL导入Exel时,不会创建Laravel模型

V-icon 在 Vuetify 3 中不显示图标

Laravel Homestead vagrant up 超时

如何使用 Laravel 查询生成器在 WHERE 条件周围添加括号

给定的角色或权限应该使用 guard `` 而不是 `web`. -Laravel

Laravel Eloquent - 随叫随到的加密/解密数据

Laravel:如何在 laravel 查询生成器中使用派生表/子查询

验证规则 required_if 与其他条件(Laravel 5.4)

具有实时和 WebSockets 的 Angular2 + Laravel

Laravel 5.1 是否与 PHP 7 兼容

调用未定义的函数 App\Http\Controllers\ [函数名]

Laravel Eloquent:访问属性和动态表名

Laravel - 排序的集合输出不是数组

如何在 AWS Elastic Beanstalk 上设置和使用 Laravel 调度?

php Laravel-遇到格式不正确的数值(在字符串上)

Laravel 5 - 判断日期是否是今天

Mac OS X 需要 Mcrypt PHP 扩展

使用 Laravel Mix 合并多个文件

Laravel - artisan不工作