Browse Source

【提交内容】:上传下载,bug修复

wangyj18 9 years ago
parent
commit
a79b9459e5
1 changed files with 5 additions and 4 deletions
  1. 5 4
      display-server/src/com/ai/server/bean/UploadDownloadBean.java

+ 5 - 4
display-server/src/com/ai/server/bean/UploadDownloadBean.java

56
		try {
56
		try {
57
			/* 多个上传文件 */
57
			/* 多个上传文件 */
58
			List<FileItem> fileList = upload.parseRequest(request);
58
			List<FileItem> fileList = upload.parseRequest(request);
59
			if(fileList.size() != filePaths.length){
60
				MobileUtility.error("提交的文件数量和保存的文件列表数量不一致,请检查参数!");
61
			}
59
			// 多文件上传判断 还有些问题,未调通
60
//			if(fileList.size() != filePaths.length){
61
//				MobileUtility.error("提交的文件数量和保存的文件列表数量不一致,请检查参数!");
62
//			}
62
			for (int i = 0; i < fileList.size(); i++) {
63
			for (int i = 0; i < fileList.size(); i++) {
63
				FileItem item = fileList.get(i);
64
				FileItem item = fileList.get(i);
64
				String name = item.getFieldName();// 获取表单的属性名
65
				String name = item.getFieldName();// 获取表单的属性名
71
					request.setAttribute(name, value); // 保存文件名
72
					request.setAttribute(name, value); // 保存文件名
72
					//文件在server上保存地址
73
					//文件在server上保存地址
73
					filePath = ApplicationPath.getFilePath(request) + filePaths[i];
74
					filePath = ApplicationPath.getFilePath(request) + filePaths[i];
74
					File dir = new File(filePaths[i]).getParentFile();
75
					File dir = new File(filePath).getParentFile();
75
					if(! dir.exists() && ! dir.mkdirs()){
76
					if(! dir.exists() && ! dir.mkdirs()){
76
						MobileUtility.error("创建上传文件夹失败!");
77
						MobileUtility.error("创建上传文件夹失败!");
77
					}
78
					}