In C#, how can I know the file type from a byte[]?

后端 未结 10 1253
不思量自难忘°
不思量自难忘° 2020-11-28 08:28

I have a byte array filled from a file uploaded. But, in another part of the code, I need to know this file type uploaded from the byte[] so I can render the correct content

10条回答
  •  一生所求
    2020-11-28 09:27

    You don't want to do it that way. Call Path.GetExtension when the file is uploaded, and pass the extension around with the byte[].

提交回复
热议问题