I have this code:
<h:form id="form" enctype="multipart/form-data">
<t:inputFileUpload id="eFile" value="#{Parser.uploadFile}" storage="file"/>
<t:commandButton value="Parse" action="#{Parser.parse}"/>
</h:form>
And in my Parser class:
public class Parser {
public Parser() {
}
public String parse() {
//it should be 'application/vnd.ms-excel' type
//since i'm uploading an excel file saved in MS Excel 2007
System.err.print(uploadFile.getContentType());
// but its content-type is 'application/octet-stream'
return null;
}
public UploadedFile getUploadFile() {
return uploadFile;
}
public void setUploadFile(UploadedFile uploadFile) {
this.uploadFile = uploadFile;
}
}
In my project everywhere excel files are checked depending on its content-type, they worked fine some time ago, but now I couldn't understand why they are not working properly.