public function getFileMimeType($filename, $service)
    {
        $binary = '/usr/bin/file';
        $mime_type = $this->exec(
            "if [ -e {$binary} ]; then {$binary} -b --mime-type {$filename}; fi",
            $service,
            [],
            true
        );

        if (empty($mime_type)) {
            throw new \Exception(
                sprintf('No mime type was captured for %s.', $filename)
            );
        }

        return $mime_type;
    }
public function getFileMimeType($filename, $service)
    {
        $binary = '/usr/bin/file';
        $mime_type = $this->exec(
            "if [ -e {$binary} ]; then {$binary} -b --mime-type {$filename}; fi",
            $service,
            [],
            true
        );

        if (empty($mime_type)) {
            throw new \Exception(
                sprintf('No mime type was captured for %s.', $filename)
            );
        }

        return $mime_type;
    }
public function getFileMimeType ( $ filename , $ service ) { $ binary = '/usr/bin/file' ; $ mime_type = $ this -> exec ( "if [ -e {$binary} ]; then {$binary} -b --mime-type {$filename}; fi" , $ service , [ ] , true ) ; if ( empty ( $ mime_type ) ) { throw new \ Exception ( sprintf ( 'No mime type was captured for %s.' , $ filename ) ) ; } return $ mime_type ; }
Get the file mime type.

@param $filename
The path to the file.
@param $service
The service to run the command inside.

@return bool|string
@throws \Exception
Get the file mime type .