In C#, how can I know the file type from a byte[]?
As mentioned, MIME magic is the only way to do this. Many platforms provide up-to-date and robust MIME magic files and code to do this efficiently. The only way to do this in .NET without any 3rd party code is to use FindMimeFromData from urlmon.dll. Here’s how: public static int MimeSampleSize = 256; public static … Read more