How to get the Content Type(MimeType) of a file C#
private string MimeType (string Filename)
{
string mime = “application/octetstream”;
string ext = System.IO.Path.GetExtension(Filename).ToLower();
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (rk != null && rk.GetValue(“Content Type”) != null)
mime = rk.GetValue(“Content Type”).ToString();
return mime;
}

It’s work!
Thanks!!!!!!
.
I have used your solution in my project with flash upload
THANKS!!
[...] getMimeTypeFromExtension Hi Alhambra, That’s it http://petrocel.wordpress.com/2008/0…e-of-a-file-c/ > Hi misters, > > In Java there is the MimeType.getMimeTypeFromExtension function. > [...]
getMimeTypeFromExtension | keyongtech ha detto questo su Gennaio 18, 2009 a 6:29 pm
Thanks It Works