【发布时间】:2021-05-29 19:52:59
【问题描述】:
我的图像工作正常,但现在我的存储目录有问题。
在他们去之前:
但现在他们要去这里:
我的代码配置文件控制器:
if($r->hasFile('profile_avatar')){
Auth::user()->update([
'profile_avatar' => $r->profile_avatar->store('public/avatars')
]);
}
if($r->hasFile('banner')){
Auth::user()->profile()->update([
'banner' => $r->banner->store('public/avatars')
]);
}
Session::flash('success', 'Perfil Atualizado com Sucesso!');
return redirect()->back();
}
以前可以,但是现在不显示任何图片
<img src="{{ Storage::url($user->profile_avatar) }}" width="400px" height="400px" style="border-radius: 50%; display: inline-block" alt="" class="unselectable">
【问题讨论】:
-
$r->profile_avatar->store('public/avatars') $r 有这个存储功能吗?似乎应该控制保存目录结帐:laravel.com/docs/8.x/filesystem
-
检查 config/filesystem.php 文件以配置您的默认存储驱动程序及其路径