1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Image not displaying in Laravel, getting 404 error even though the file exists

Discussão em 'Outras Linguagens' iniciado por WPdev11, Setembro 27, 2024 às 19:22.

  1. WPdev11

    WPdev11 Guest

    I'm working with media files in my Laravel application. The files are being stored in the database and in the proper folders, but they are not displaying in the browser.

    This is the rendered <img> tag in the browser's front end:

    <img src="http://localhost/public/uploads/18-4f2d6e8f609942df5f746775345a9430/man.png" alt="Image">


    When I navigate to <my-laravel-application-root-folder>/public/uploads/18-4f2d6e8f609942df5f746775345a9430/man.png, the file is there, but the image won't show on the frontend.

    Here is my filesystem configuration in config/filesystems.php:

    'public' => [
    'driver' => 'local',
    'root' => storage_path('uploads'),
    'url' => env('APP_URL') . '/public/uploads',
    'visibility' => 'public',
    'throw' => false,
    ],


    I have already run the command:

    php artisan storage:link


    However, when I try to access the image via the URL in the rendered <img> tag, it gives me a 404 error.

    I am not sure if I am missing a step, or am doing something wrong, but what could be causing this issue, and how can I resolve it?

    Continue reading...

Compartilhe esta Página