FilamentF
Filament12mo ago
frame

FileUpload file validation after upload, before submit

Is it possible to validate a FileUpload field before submit? I can access the uploaded file using
afterStateUpdated
and similar functions, but is there any function other than rules that has access to $fail? I tried throwing ValidationError, etc but those didn't seem to work.
Solution
Thanks! 💖 I may have gotten it working with
->afterStateUpdated(function (\Livewire\Component $livewire, Forms\Components\FileUpload $component) 
    $livewire->validateOnly($component->getStatePath())
})
Was this page helpful?