mardi 2 avril 2019

Get / Read laravel 5.8 Storage non public Folder files to View?

Try to access 'storage/app/folder1/a.png' from my view

enter image description here

public function viewStorageFiles()
{
    $fileFullPath = Storage::disk('local')->path('folder1/a.png');
    $fileUrl = Storage::disk('local')->url('app/folder1/a.png');
    $storage_path = storage_path('app/folder1/a.png');

    return view('email.fileDownload')->with([
        'fileFullPath' => $fileFullPath,
        'fileUrl' => $fileUrl,
        'storage_path' => $storage_path,
        ]);
}

In view : email.fileDownload

<div>
    <p>  asset($fileUrl) ==> </p>
    <img src=""/>
</div>
<div>
    <p>  url($fileUrl) ==> </p>
    <img src=""/>
</div>
<div>
    <p>  storage_path($fileUrl) ==> </p>
    <img src=""/>
</div>

the result is : enter image description here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2TVZBig
via IFTTT

Aucun commentaire:

Enregistrer un commentaire