Private Function MimeType(Filename As String) As String Dim mime As String = "application/octetstream" Dim ext As String = System.IO.Path.GetExtension(Filename).ToLower() Dim rk As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext) If rk IsNot Nothing AndAlso rk.GetValue("Content Type") IsNot Nothing Then mime = rk.GetValue("Content Type").ToString() End If Return mime End FunctionIn short - you just feed it with path top a file - and get back the mime type. Ex MimeType("f:\\theimage.jpg") --->>> "image/jpeg"
Saturday, October 29, 2011
Getting Mimetype .NET
Subscribe to:
Post Comments (Atom)
Casino, Hotel & RV Park Reviews, Ratings & Photos
ReplyDeleteComplete casino 구리 출장마사지 information 동두천 출장마사지 including address, telephone 태백 출장안마 number, photos, 익산 출장샵 videos, games, and 구리 출장샵 other amenities at Casino, Hotel & RV Park.