Get file extension in Laravel
There is a function called “ extension() ” on the file object in Laravel . This will return the file extension as a string. It works on every file object. E.g. on the request object or on the file facade itself. It also will work on some storage instances.  Get file extension on a uploaded file: $extension = $request->file('file_input')->extension(); Get file extension on a file saved on the filesystem: $extension = File::get($filePath)->extension() Get the mime type