Programatically find out a file type by looking its binary content. Possible?

Posted by daemonkid on Stack Overflow See other posts from Stack Overflow or by daemonkid
Published on 2010-05-27T13:45:51Z Indexed on 2010/05/27 13:51 UTC
Read the original article Hit count: 236

Filed under:
|
|

I have a c# component that will recieve a file of the following types .doc, .pdf, .xls, .rtf

These will be sent by the calling siebel legacy app as a filestream.

So...

[LegacyApp] >> {Binary file stream} >> [Component]

The legacy app is a black box that cant be modified to tell the component what file type (doc,pdf,xls) it is sending. The component needs to read this binary stream and create a file on the filesystem with the right extension.

Any ideas?

Thanks for your time.

© Stack Overflow or respective owner

Related posts about c#

Related posts about filestream