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