How do you go about verifying the type of an uploaded file reliably without using the extension? I\'m guessing that you have to examine the header / read some of the bytes,
Here's a quick-and-dirty response to the followup question you posted:
byte[] jpg = new byte[] { 0xFF, 0xD8, 0xFF, 0xE0 }; bool match = true; for (int i = 0; i < jpg.Length; i++) { if (jpg[i] != b[i]) { match = false; break; } }