Laravel Livewire Shows Error “File Failed to Upload” After Selecting a File — On Production Server [SOLVED]

Christogonus Obasi
2 min readJul 4, 2023
Livewire file upload error on production server

The Livewire upload error in our case was caused by “finfo” not activated on production server.

Working with laravel’s TALL stack appears sweet until you encounter a client who uses shared hosting for their websites — because they have fallen in love with the easy-to use interface.

This was our case for a project handled in June 2023. There was nothing we could say to talk them out of what they love — but we cannot afford to fail in the project.

Now, here is why I am jumping on to write this post.

We searched extensively on the search engine for possible reasons why this error occurred, most of the recommendations pointed towards tampering with the livewire core files. Well, that is not our organization likes at all.

How We Found The Cause Of The Error:

This error is frustrating and time-consuming — and annoying at the same time to have error show up only on production server. In our case, it delayed our job delivery by 24 hours.

Then, the project manager requested the form page and upload script be written in without javascript interference (from both Alpine and Livewire).

This was done and pushed to the production server. On testing, laravel displayed the error of file upload because of the absence of fileinfo (finfo).

As this got activated, everything worked fine.

Note

It is important to note that there might be other reasons why you might encounter this kind of error on production server.

Always feel free to try our approach…

As in our tradition, you can take out time to do the part of the web app in another way that could give you verbose error notice.

If you change Laravel core files or mutilate any public packages used in the web app you are building, there is a high probability that when you come back 1year later to update to latest version of the ecosystem or even to add new functions to the application, it will break.

I hope that sharing our experience will help other developers who face similar issues get solution.

--

--

Christogonus Obasi

I am a software developer and I work full time at Thriving Smart LLC! https://thrivingsmart.com