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
FileUpload expects an array, even if it’s only one image.
Are you using the admin package or the stand alone forms package?
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
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. 🙈