Laravel - 图片保存在存储文件夹中,但无法显示给用户。

12 浏览
0 Comments

Laravel - 图片保存在存储文件夹中,但无法显示给用户。

我有这段代码来保存图像在storage/app/uploads文件夹中

$image_main = Image::where('property_id', $id)->get();
$file = $request->file('file');
$destinationPath = 'uploads';
$i = 0;
foreach ($file as $file1) {
    $i++;
    $extension = $file1->getClientOriginalExtension();
    $path = $file1->storeAs(
        $destinationPath, $i.time().".".$extension
    );
}

这是我的blade文件

@foreach ($image_main as $images)
    filename}}

文件保存在storage/app/uploads文件夹中,但用户无法看到,显示文件未找到。我需要在filesystems.php文件中设置什么吗?

0