Populate the FileUpload Field with uploaded image on EditProfile page

Hi, I'm using a SpatieMediaLibraryFileUpload field on my EditProfile page to upload a profile picture. The uploading and saving works, but if I navigate to the edit page again, the FileUpload field will be empty. I want to populate the field with the already uploaded image. The image is uploaded to the related model UserProfile. How can I achieve this? This is my code for the field:
SpatieMediaLibraryFileUpload::make('profile_picture')
->image()
->collection('profile_pictures')
SpatieMediaLibraryFileUpload::make('profile_picture')
->image()
->collection('profile_pictures')
2 Replies
toeknee
toeknee2w ago
Can you check your console, I suspect the disk you are loading the files too isn't accessible by http requests?
Matthew
Matthew2w ago
I agree If you are using a public disk, you need to run php artisan storage:link

Did you find this page helpful?