Laravel file download - php_fileinfo extension not enabled

Viewed 4839

I'm using Laravel 5.4.13 with PHP 7.1 and I migrated to a shared hosting. I'm trying to make the website work, but I'm unable because of a missing extension: php_fileinfo

This is the code where the website crashes:

$file = base_path() . "/storage/app/public/small.mp4";
return response()->download($file, "small.mp4")->deleteFileAfterSend(true);

and this is the error what Laravel gives:

LogicException in MimeTypeGuesser.php line 135:
Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)

I contacted the web hosting company and they told me that they can't enable this extension because of security measurements.

What alternative I have? Is there any other Laravel/PHP function to download a file? Should I use a different framework?

1 Answers
Related