I have a file upload function, which accept xlsx and xls file.
Here is the code snippet:
But as I upload xls file, it throw this exception
Solution The error is telling you that POI couldn't find a core part of the OOXML file. Your file isn't a valid OOXML file, let alone a valid .xlsx file. So you need to use HSSFWorkbook instead of XSSFWorkbook.