我正在尝试使用以下方法将图像从一个文件夹移动到另一个文件夹:
Storage::move(storage_path('app/public/temporary/').$imageName, storage_path('app/public/profilePic/'.$imageName));
但是当我运行它时,它给了我错误:
在以下位置找不到文件:home / vagrant / code / avida / storage / app / public / temporary / 5bfb7272e9dc9.download.jpeg
我在Google上找到了以下解决方案:
Storage::disk('local')->move(storage_path('app/public/temporary/').$imageName, storage_path('app/public/profilePic/'.$imageName));
但是它又给出了另一个错误:
在\ Illuminate \ Support \ Facades \ Storage
中找不到方法“磁盘”
任何人都可以帮助我如何移动此文件? 谢谢
答案 0 :(得分:0)
存储类在存储目录中运行,因此不需要使用storage_path()帮助器。
将您的代码更改为以下代码:
Storage::move('public/temporary/'.$imageName, 'public/profilePic/'.$imageName);
我希望能对您有所帮助:)