How do I access the uploaded file?

I have 2 nearly identical forms on livewire components. In one of them, the file upload works fine and I get the TemporaryUploadedFile when I do $this->form->getState(). On the other one, I just get null.
public function form(Form $form): Form
{
return $form->schema([


FileUpload::make('document')
->label('Upload Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf'])
->maxSize(12288)
->storeFiles(false)
//->hidden(fn () => $this->statement?->document_id !== null)
])->statePath('data');
}
public function form(Form $form): Form
{
return $form->schema([


FileUpload::make('document')
->label('Upload Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf'])
->maxSize(12288)
->storeFiles(false)
//->hidden(fn () => $this->statement?->document_id !== null)
])->statePath('data');
}
I have this in my render method: $this->form->fill($this->statement->attributesToArray()); and doing this in my save method:
public function save(): void
{
dd($this->form->getState());
}
public function save(): void
{
dd($this->form->getState());
}
document is just null. I feel like this was previously working, so I don't know what changed.
No description
1 Reply
Jon Mason
Jon Mason3mo ago
oh wait, i just moved the form fill to the mount method and now it's working. ugh.