private string GetFileMimeType(string extension) { char[] arr = extension.ToCharArray(); arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c)))); extension = new String(arr).ToLower(); Dictionary<string, string> lstMimeTypes = new Dictionary<string, string> { {"ai", "application/postscript"}, {"aif", "audio/x-aiff"}, ...