public static string GetMimeType(string fileName)
{
if (fileName == null) { return null; }
string result = null;
var dot = fileName.LastIndexOf('.');
if (dot != -1 && fileName.Length > dot + 1) { Types.TryGetValue(fileName.Substring(dot + 1), out result); }
return result ?? "application/octet-stream";
}