is it possible to set the existing avatar on page load?
Ony my edit profile page, the user can select an avatar using the file upload component. After it's selected, or when the page loads if they've previously selected one, I want to populate the upload component with the existing file from the url I have stored in my users table. It's not obvious from the docs how to do that, or if it's possible. I tried just adding that as a field in $this->form->fill() in my mount method, but that's not doing it.
3 Replies
I also tried this:
it's a public file in S3.
Why n ot just fill the form with the record as normal? that should load the same was as it is saved
It looks like the issue may be that it wasn't saved to s3, so I'm hoping once i fix that, it will work.
ok, saving to s3 and the path matches what's in the database, and neither of the options I mentioned above are working.
Using
Using
$this->user->avatar_path
in $this->form->fill()
yields a white circle. Using the generated url just shows the normal file upload component.
Does anyone have any ideas on this? I can't be the only one who's wanted this. I imagine I need to somehow set the FileUpload component with a new UploadedFile
object on page load, but unaware of how I could do that.