Skip to content

Fix: "Unable to retrieve the file_size" on file upload (Filament 5 / Livewire)#21

Open
xchimx wants to merge 1 commit intomwguerra:mainfrom
xchimx:patch-2
Open

Fix: "Unable to retrieve the file_size" on file upload (Filament 5 / Livewire)#21
xchimx wants to merge 1 commit intomwguerra:mainfrom
xchimx:patch-2

Conversation

@xchimx
Copy link

@xchimx xchimx commented Mar 13, 2026

Description
This PR fixes an issue where successful file uploads are logged and treated as errors, throwing Unable to retrieve the file_size for file at location: livewire-tmp/....

Root Cause
With recent Livewire versions (especially noticeable after upgrading to Filament 5), temporary files are moved/deleted immediately upon calling $file->storeAs().
Because the Log::info block directly after storeAs() tried to fetch $file->getSize() and $file->getMimeType() from the temporary livewire-tmp path, Flysystem threw a UnableToRetrieveMetadata exception.

Solution
I simply reordered the logic to retrieve the file metadata (size and mime_type) before storeAs() is executed. This prevents the exception and allows the upload flow to complete successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant