/**
* 检查是否存在upload文件漏洞
* (上传文件类型不能是jsp、php、js、html等)
*
* @param fileName
* @throws Exception
*/
public static void checkUploadFileXssDanger(String fileName) throws Exception {
if(fileName == null || fileName.trim().equals("")){
return;
}
String tmpFileName = fileName.trim().toLowerCase();
if(tmpFileName.endsWith(".jsp") ||
tmpFileName.endsWith(".php") ||
tmpFileName.endsWith(".js") ||
tmpFileName.endsWith(".htm") ||
tmpFileName.endsWith(".html"))
{
throw new Exception("上传文件类型不合法!");
}
}