在上传“.jpg/.jpeg”之类的图像时,“.png”文件 <s:graphicImage> 标签采用这些文件类型,但不采用“.bmp”类型文件。任何人都可以帮助指导解决这个问题吗?
private boolean chkImageUpload(){
log.info("chkImageUpload started");
boolean chk = false;
long fileSize = 0;
String contentType = null;
FacesContext context = FacesContext.getCurrentInstance();
try {
if(object.getTempPhotoGraph() != null){
contentType = object.getInefFileType();
if (!((contentType.contains("jpeg"))||(contentType.contains("jpg"))||(contentType.contains("gif"))||(contentType.contains("tiff"))||(contentType.contains("bmp")))){
facesMessages.add("JPG/JPEG/GIF/TIFF/BMP type of images are allowed");
return chk;
}
}
} catch (Exception e) {
log.error(e);
}
log.info("chkImageUpload ended");
return chk;
}