F
Filamentβ€’11mo ago
Booltje124

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
Vpβ€’11mo ago
what if you remove last / in app_url, is the response same?
Booltje124
Booltje124OPβ€’11mo ago
unfortunately no change
Vp
Vpβ€’11mo 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
Booltje124OPβ€’11mo ago
No, only FileUpload::make('image') ->image()
Vp
Vpβ€’11mo ago
Did you host your server like this php artisan serve --host=127.0.0.1 if not try it
Booltje124
Booltje124OPβ€’11mo ago
I use herd which starts automatically
Matthew
Matthewβ€’11mo ago
Thr problem is the link Try APP_URL=http://127.0.0.1:8000 Without the / in the end
Matthew
Matthewβ€’11mo ago
If you carefully read your error, you will see it as well
No description
Matthew
Matthewβ€’11mo ago
You shouldnt have // there
Booltje124
Booltje124OPβ€’11mo ago
I see! Changed it now. Do i have to do anything else?
No description
Booltje124
Booltje124OPβ€’11mo ago
It has a single / now, but not showing
Matthew
Matthewβ€’11mo ago
Now you are creating a new record, right? Not trying to view the old ones
Booltje124
Booltje124OPβ€’11mo ago
Right, created a new record.
Matthew
Matthewβ€’11mo ago
Can you show your model? Im curious
Booltje124
Booltje124OPβ€’11mo ago
The form for the model you mean?
Dennis Koch
Dennis Kochβ€’11mo ago
Did you run artisan storage:link?
Booltje124
Booltje124OPβ€’11mo ago
The [public/storage] link already exists.
Matthew
Matthewβ€’11mo 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
Booltje124OPβ€’11mo ago
No description
Matthew
Matthewβ€’11mo ago
look right Can you show your $fillable and $casts in your model?
Booltje124
Booltje124OPβ€’11mo ago
No description
Matthew
Matthewβ€’11mo ago
add 'image' => 'array' to the casts array
Booltje124
Booltje124OPβ€’11mo ago
unfortunately no change
Matthew
Matthewβ€’11mo ago
Can you show the table migration? Just the line where you define the image column
Booltje124
Booltje124OPβ€’11mo ago
$table->text('image');
Brian.
Brian.β€’11mo ago
Shouldn't that be a json column?
Matthew
Matthewβ€’11mo ago
Nah I have it a string And it works The problem lies elsewhere
Brian.
Brian.β€’11mo ago
Oh wait it's singular
Booltje124
Booltje124OPβ€’10mo 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
Booltje124β€’10mo ago
It was the app url. Had to use the exact herd url πŸ˜…
Want results from more Discord servers?
Add your server