How to get uploaded file in page action

In my List page, I have a page action with a form that contains a FileUpload::make('test-file'). In the ->action(fn (array $data)...) I need to get the uploaded file. According to the docs, I should do $data['test-file'] but that only contained a string (I think the internal livewire temp value for the file). How do I get the uploaded file in the $data ? Currently, I do something like:
$filePath = Storage::disk('public')->path(array_values($this->mountedActionData['test-file'])[0]);
$filePath = Storage::disk('public')->path(array_values($this->mountedActionData['test-file'])[0]);
Is there a better way?
2 Replies
Dan Harrin
Dan Harrin2y ago
the string is the path to the real file so you can use that to fetch the file contents
damms005
damms005OP2y ago
Thanks thanks
Want results from more Discord servers?
Add your server