Home / Snippets / How to get mime type in Laravel 9
How to get mime type in Laravel 9 cover

How to get mime type in Laravel 9

4.4K

2 years ago

0 comments

In Laravel 9 you can make use of the "mimeType()" method that's available from the "Storage" facade. This method accepts the file path and will return the type as a string.
<?php

use Storage;

$mimeType = Storage::mimeType('test.jpg');
Previously in Laravel 8, you can make use "getMimeType()" but since Laravel 9 is using Flysystem 3.0 the method has changed since then.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this