C# How can I test a file is a jpeg?

后端 未结 16 2402
失恋的感觉
失恋的感觉 2020-11-27 03:28

Using C# how can I test a file is a jpeg? Should I check for a .jpg extension?

Thanks

16条回答
  •  天涯浪人
    2020-11-27 03:57

    You could find documentation on the jpeg file format, specifically the header information. Then try to read this information from the file and compare it to the expected jpeg header bytes.

提交回复
热议问题