I have stored files in database in a column of varbinary type. Files look something like ..
"0xFFD8FFE......."
in the database. Before downloading these files I want to first check the first n characters such as first eight characters
to find out if they match "0xFFD8FF"
if they do I will save the file as ".jpg" and so on.
How can i do so??I tried many things such as
Byte[] threeBytes = new Byte[] { objData[0], objData[1], objData[2], objData[3], objData[5] }; if (objTable.Rows[0]["img"].ToString().StartsWith("0xFFD"))
{
strFileToSave += ".jpg";
}
But I am unable to compare them.