Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If picked file name have no extensions, how we will get file mime type in flutter

I'm using file picker for my application. In that, I want to know picked file mime type even file name has no extension. How it is possible?

like image 322
Maheswari Avatar asked Oct 14 '25 09:10

Maheswari


1 Answers

use this package mime

You can get mime type from file path like this:

import 'package:mime/mime.dart';
....
lookupMimeType(file.path) // output: Image/Jpeg
like image 111
HasilT Avatar answered Oct 17 '25 02:10

HasilT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!