Excel Upload Error using EPPlus ExcelPackage

445 views Asked by At

I am getting error when trying to read excel file from Request.Files (InputStream), but error came up just from a windows server machine. any idea about something missing?

EPPlus version is 4.5.2.1

Error Line:

    foreach (string file in Request.Files) {
        HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
        using (var xls = new ExcelPackage(hpf.FileStream))

  //<--- ERROR LINE

Error message:

Object reference not set to an instance of an object.
 Source: EPPlus
 StackTrace:    at OfficeOpenXml.Packaging.ZipPackage..ctor(Stream stream) at OfficeOpenXml.ExcelPackage.Load(Stream input, Stream output, String Password)
   at OfficeOpenXml.ExcelPackage..ctor(Stream newStream)
1

There are 1 answers

0
Edgar Valenzuela On

The issue was solved, the reason for the issue was the files were encrypted and when uploading they could not be read.