CmisSync.Lib.Cmis.MimeType.GetMIMEType C# (CSharp) Method

GetMIMEType() public static method

Guess the MIME type of a file.
public static GetMIMEType ( string fileName ) : string
fileName string Relative filename, for instance mydoc.odt
return string
        public static string GetMIMEType(string fileName) {
            if (!string.IsNullOrWhiteSpace(fileName) && Path.GetExtension(fileName).Length > 1 && /* File with an extension */
                MIMETypesDictionary.ContainsKey(Path.GetExtension(fileName).Remove(0, 1))) {
                return MIMETypesDictionary[Path.GetExtension(fileName).Remove(0, 1)];
            }

            // If no match, return generic MIME type.
            return "application/octet-stream";
        }
    }