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]);


Is there a better way?
Was this page helpful?