public function guessMimeType($filepath)
    {
        $magic_file = $this->getFileManager()->getMagicFile();
        $mimetype = finfo_file(finfo_open(FILEINFO_MIME_TYPE, $magic_file), $filepath);

        $extension = pathinfo($filepath, PATHINFO_EXTENSION);
        $match_extension = $this->matchMimetypeExtension($mimetype, $extension);

        //Use default mimetype guesser if it is not found
        if ($mimetype == "application/octet-stream" || !$match_extension) {
            $mimetype = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $filepath);
        }

        $this->setMimetype($mimetype);

        if (isset(self::$humanReadableTypes[$mimetype])) {
            $this->setReadableType(self::$humanReadableTypes[$mimetype]);
        } else {
            $this->setReadableType("Undefined");
        }
        $this->setFileclass($mimetype);
    }