- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
private static string GetMultipartFileContentType(string file)
{
var ext = file.Split('.').Last().ToLower();
var types = new[]
{
new[] {"application/envoy","evy"},
new[] {"application/fractals","fif"},
new[] {"application/futuresplash","spl"},
new[] {"application/hta","hta"},
new[] {"application/internet-property-stream","acx"},
new[] {"application/mac-binhex40","hqx"},
new[] {"application/msword","doc"},
new[] {"application/msword","dot"},
new[] {"application/octet-stream","*"},
new[] {"application/octet-stream","bin"},
new[] {"application/octet-stream","class"},
new[] {"application/octet-stream","dms"},
new[] {"application/octet-stream","exe"},
new[] {"application/octet-stream","lha"},
new[] {"application/octet-stream","lzh"},
new[] {"application/oda","oda"},
// Многобукв...
new[] {"x-world/x-vrml","xof"}
};
var toReturn = types.FirstOrDefault(t => t[1] == ext);
return toReturn != null ? toReturn[0] : "application/octet-stream";
}