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
If you have a limited number of expected file types you want to support, magic numbers can be the way to go.
A simple way to check is to just open example files with a text/hex editor, and study the leading bytes to see if there is something there you can use to differentiate/discard files from the supported set.
If, on the other hand, you are looking to recognize any arbitrary file type, yeah, as everyone has stated already, tough.