Images not loading in browser

Hi everyone! I am building my first app with filament, but i am getting an error which i cant solve myself. Have read several posts similar to this problem, but I have not yet been able to find the solution. When i upload an image with FileUpload, it is saved in the app storage folder, which is linked to the public storage folder with php artisan storage:link. FileUpload::make('image') ->image() I changed the app URL in the env file, but this makes no difference: APP_URL=http://127.0.0.1:8000/ Console says Net::ERR_CONNECTION_REFUSED (see attached screenshot). What could be the problem? Thank you in advance.
No description
Solution:
It was the app url. Had to use the exact herd url 😅
Jump to solution
30 Replies
Vp
Vp12mo ago
what if you remove last / in app_url, is the response same?
Booltje124
Booltje124OP12mo ago
unfortunately no change
Vp
Vp12mo ago
I just check 127.0.0.1 & localhost and yet I don't have any error.. did you use any other fn() other than image() in file upload? like visibility etc
Booltje124
Booltje124OP12mo ago
No, only FileUpload::make('image') ->image()
Vp
Vp12mo ago
Did you host your server like this php artisan serve --host=127.0.0.1 if not try it
Booltje124
Booltje124OP12mo ago
I use herd which starts automatically
Matthew
Matthew12mo ago
Thr problem is the link Try APP_URL=http://127.0.0.1:8000 Without the / in the end
Matthew
Matthew12mo ago
If you carefully read your error, you will see it as well
No description
Matthew
Matthew12mo ago
You shouldnt have // there
Booltje124
Booltje124OP12mo ago
I see! Changed it now. Do i have to do anything else?
No description
Booltje124
Booltje124OP12mo ago
It has a single / now, but not showing
Matthew
Matthew12mo ago
Now you are creating a new record, right? Not trying to view the old ones
Booltje124
Booltje124OP12mo ago
Right, created a new record.
Matthew
Matthew12mo ago
Can you show your model? Im curious
Booltje124
Booltje124OP12mo ago
The form for the model you mean?
Dennis Koch
Dennis Koch12mo ago
Did you run artisan storage:link?
Booltje124
Booltje124OP12mo ago
The [public/storage] link already exists.
Matthew
Matthew12mo ago
Yes You need to cast to column to array If thats not the issue, then it should be your filesystems.php confiuration Share that also please
Booltje124
Booltje124OP12mo ago
No description
Matthew
Matthew12mo ago
look right Can you show your $fillable and $casts in your model?
Booltje124
Booltje124OP12mo ago
No description
Matthew
Matthew12mo ago
add 'image' => 'array' to the casts array
Booltje124
Booltje124OP12mo ago
unfortunately no change
Matthew
Matthew12mo ago
Can you show the table migration? Just the line where you define the image column
Booltje124
Booltje124OP12mo ago
$table->text('image');
Brian.
Brian.12mo ago
Shouldn't that be a json column?
Matthew
Matthew12mo ago
Nah I have it a string And it works The problem lies elsewhere
Brian.
Brian.12mo ago
Oh wait it's singular
Booltje124
Booltje124OP12mo ago
Dont think model or migration has something to do with the image error. I see the image in the folder, and correct path in the browser url and database Also created a new laravel project, and used only the forms plugin and table plugin. Image are also not displaying.
Solution
Booltje124
Booltje12412mo ago
It was the app url. Had to use the exact herd url 😅

Did you find this page helpful?