In C#.NET 4.0, based on a problem I had with downloading false images (saving an error aspx page as image.jpg instead of an actual image in image.jpg), I need to somehow read the file and identify if it is a valid image or not. I just need 1 function public bool IsValidJpgImage(string ImageFilename); Anything that returns false (is not a valid image file) I will delete from the disk.
In C#.NET 4.0 , based on a problem I had with downloading false images
Share
As far I as I know all JPEGs begin internally with same 10 character ASCII string although I can’t remember what the first 6 characters are. This is quick/dirty method of indentifying a jpeg image even if the file extension is wrong.
If the image is not a jpeg the match will fail.