F
Filamentβ€’2mo ago
frame

File upload in a wizard step?

Is it possible to use FileUpload in a Wizard step, read the file, then use the data in a subsequent step? For example upload a csv, then review the data in the next step. I tried to use afterValidation but cannot figure out how to find the uploaded file's path. But I'm not sure if this idea is possible in the first place. πŸ€” https://filamentphp.com/docs/4.x/schemas/wizards#step-lifecycle-hooks
Solution:
$get might work here 😺 now onto figuring out how I can display error messages from Halt to the user, and setting the state on the next step
Jump to solution
2 Replies
Solution
frame
frameβ€’2mo ago
$get might work here 😺 now onto figuring out how I can display error messages from Halt to the user, and setting the state on the next step
frame
frameOPβ€’2mo ago
Couldn't figure it out, had to make a fake error element and $set it
TextEntry::make('error')
->hiddenLabel()
->color('danger')
->visible(fn (Get $get): bool => $get('csv_error') !== null)
->state(fn (Get $get): string => $get('csv_error') ?? ''),
TextEntry::make('error')
->hiddenLabel()
->color('danger')
->visible(fn (Get $get): bool => $get('csv_error') !== null)
->state(fn (Get $get): string => $get('csv_error') ?? ''),

Did you find this page helpful?