是的,你可以这样做存储::移动 https://laravel.com/docs/5.8/filesystem#storing-files and 公共路径() https://laravel.com/docs/5.8/helpers#method-public-path helper.
Storage::move( 'old/file.jpg', public_path('new/file.jpg') );
注意old/file.jpg
是相对于your-project/storage/app
,所以您要移动的文件将位于your-project/storage/app/old/file.jpg
UPDATE
不过,另一种方法可能是将文件移动/存储在laravel-project/storage/app/public
.
然后通过公共目录可以访问它符号链接 https://laravel.com/docs/5.8/filesystem#the-public-disk.
之后里面的所有文件和目录laravel-project/storage/app/public
将链接到laravel-project/public/storage/
目录。
然后就可以通过url访问该文件了。
因此,要以这种方式执行此操作,请将文件移动到 storage/app/public/ 文件夹:
Storage::move( 'old/file.jpg', 'public/movedfiles/file.jpg' );
通过此 artisan 命令创建符号链接:
php artisan storage:link
然后你可以通过url访问该文件:
<a href='http://your-domain/storage/movedfiles/file.jpg'>file.jpg</a>
或在刀片中
<a href='{{ asset('storage/movedfiles/file.jpg') }}'>file.jpg</a>