mercredi 11 octobre 2017

Laravel 5.5 - access storage images with no creating sym link - throws 400 error

routes.php

Route::get('img/{filename}', 'FilesController@show')->name('files.show');

my FilesController

public function show($filename)
{
    if (!Storage::exists('img/' . $filename))
    {
        return 'error'; //file exist, this is never executes
    }
    $file = Storage::get('img/' . $filename); // this line breaks
    dd($file);

    return new Response($file, 200);
}

the Storage::get('img/' . $filename) throws error 400 on page... the path is good...

I dont want public link because I want images to be private and to access only via controller...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire