Hi everyone,
I’m building a Filament form dynamically. Most fields work fine, but I can’t get FileUpload to display an already saved file when the form is reloaded.
This is the field:
FileUpload::make('medical.Testfile')
->openable()
->visibility('public')
->acceptedFileTypes(['application/pdf', 'image/jpeg', 'image/png'])
->directory('custom_field')
->maxFiles(1);
Uploading works correctly:
the file is stored on disk,
and I can open it in the browser (so the path/visibility seems fine).
However, after reloading the edit page, the FileUpload component is empty, while my other fields do hydrate correctly.
This is the data stored in my model (inside the medical attribute):
[
"Testfile" => "custom_field/nzzP4HL5XIyRcsJQzw1kYoumOKvMLxtunrvwJ58Q.png",
"Testtext" => "sdfdsfsdf",
]
Testtext is rendered as a normal text input and shows the saved value correctly. Only the FileUpload stays empty.
I also tried different formats for Testfile, like:
["custom_field/...png"]
["file" => "custom_field/...png"]
…but it still doesn’t render.
Does anyone know what FileUpload expects for hydration in this situation, or how I can debug why the state isn’t being shown?
Thanks!