When loading a old Microsoft Office file into a stream or byte array, the GetFileType() resulting MimeType is doc,ppt,xls, not the expect xls or doc.
For example. Both text fail.
[Fact]
public void CanReadExcelFileFromByteArray()
{
var result = File.ReadAllBytes("./data/Documents/XlsExcel2007.xls").GetFileType();
Assert.NotNull(result);
Assert.Equal(MimeTypes.EXCEL, result);
}
[Fact]
public void CanReadExcelFileFromStream()
{
using (FileStream stream = File.Open("./data/Documents/XlsExcel2007.xls", FileMode.Open))
{
var result = stream.GetFileType(false, true);
Assert.NotNull(result);
Assert.Equal(MimeTypes.EXCEL, result);
}
}
Any ideas how to get this to work without having to save the files to disk and then loading them using the FileInfo object?
When loading a old Microsoft Office file into a stream or byte array, the GetFileType() resulting MimeType is doc,ppt,xls, not the expect xls or doc.
For example. Both text fail.
Any ideas how to get this to work without having to save the files to disk and then loading them using the FileInfo object?