Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

viktor3177's avatar

Images not showing in laravel 9.

Hello! There is a problem with the display of images on the site! I have an editor (TinyMCE5) and I installed (filemanager) on it, everything works as it should locally, but if I transfer it to the hosting, the pictures are not displayed, error 404.

Here's how it's done in file(filesystems.php)

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
        'throw' => false,
    ],

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

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
        'endpoint' => env('AWS_ENDPOINT'),
        'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
        'throw' => false,
    ],

],
0 likes
23 replies
Sinnbeck's avatar

Did you forget to symlink? php artisan storage:link

Tray2's avatar

How about you show some code, and tell us what error message you get?

viktor3177's avatar

@Tray2

This is the error it shows in the console.

Failed to load resource: the server responded with a status of 404 ()

viktor3177's avatar

@MichalOravec

I really want someone to help me, I just don’t understand, for example, what code to show. Because the error is visible only in the console.

Hzu's avatar

You used TinyMCE to upload those files, yes?

Did you store the URLs in your database? If yes, did you store the full URL or only the relative path?

viktor3177's avatar

@Hzu

Yes I am using TinyMCE to upload those files.

You can say more about URLs.

Hzu's avatar

@viktor3177 That is the reason why your images are not loaded when viewed from the server. When a browser tries to load assets from http://localhost, it will try to load them from the visitor's computer (localhost). If it's a full URL to an online storage server like Amazon S3, then there is no problem.

I'm not sure how TinyMCE file manager works but you should be able to parse the URL and get only the path before saving it into the database. This way, you can put your images in storage and server will tell the browser to load the one stored inside the server instead.

viktor3177's avatar

The fact is that I registered the port in the LAN and it helped, without this it also does not work then.

 APP_URL=http://localhost:8000

Please or to participate in this conversation.