Prefill FileUpload field from existing path in storage

Is there a way to prefill the FileUpload field in a custom form component? what is needed in the $form->fill()? the url to the file, the path? i tried a lot, doesn‘t seem to work. Am i missing something?
3 Replies
awcodes
awcodes2y ago
FileUpload expects an array, even if it’s only one image. Are you using the admin package or the stand alone forms package?
Dan Harrin
Dan Harrin2y ago
it should be the file name of the file, and optionally the directory within the disk. we do the rest and while the state of the field is an array, we will transform it if you just pass a single string to fill(). so dont worry about that too much
derpoho
derpoho2y ago
ok thanks @Dan Harrin will try that! worked. thanks. my problem was that i have more than one upload and i filled the form with a collection instead of an array, the dot notation didn't get the correct file from the collection then, so it was always null. 🙈
Want results from more Discord servers?
Add your server