//得到上传文件的保存目录,将上传的文件存放于WEB-INF目录下,不允许外界直接访问,保证上传文件的安全
String savePath = this.getServletContext().getRealPath("/WEB-INF/upload");//上传时生成的临时文件保存目录
String tempPath = this.getServletContext().getRealPath("/WEB-INF/temp");int serverid = 0;int sid = 0;int gid = 0;byte answerLibraryType = 0;
String className= "";
String roleName= "";boolean bool = true;//判断数据是否正确
File tmpFile = newFile(tempPath);
StringBuffer str= newStringBuffer();if (!tmpFile.exists()) {//创建临时目录
tmpFile.mkdir();
}//消息提示
String message = "";try{//使用Apache文件上传组件处理文件上传步骤://1、创建一个DiskFileItemFactory工厂
DiskFileItemFactory factory = newDiskFileItemFactory();
factory.setSizeThreshold(1024 * 100);//设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB//设置上传时生成的临时文件的保存目录
factor