dimanche 11 octobre 2020

Image charged but with 404 response in Laravel 5.3

When I charge a logo storaged in storage, the logo charged perfectly but with 404 response. So, I've problem chargin the logo with PDFDom. The code for the logo route is the next:

Route::get('logos/{filename}', function($filename)
{
    $filePath = storage_path().'/app/public/logos/'.$filename;

    if ( ! File::exists($filePath) or ( ! $mimeType = mime_content_type($filePath)))
    {
        return Response::make("File does not exist.", 404);
    }

    $fileContents = File::get($filePath);

    return Response::make($fileContents, 200, array('Content-Type' => $mimeType));
});

For example: https://psicoreg.com/logos/63-psy-1602418096.png

Thank you in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire