2017-12-18 16:25

@JFinal 已经解决了。

2017-12-18 15:21

@JFinal public void InsertMatList() {
MessageData data = new MessageData();
Integer sult;
try {
// List listfile=new ArrayList<>();
UploadFile file = getFile("file_cont");
// Map map = new HashMap();
// map.put("file_cont", file.getUploadPath());
String fileName = file.getFileName();

String app01 = getPara("app01");

String path = "upload/".trim();

String realPath = getSession().getServletContext().getRealPath(path);
String newName = fileName;
String filePath = path + newName.trim();
file.getFile().renameTo(new File(realPath + "/" + newName));

sult = PopAnnex.dao.InsertMatList(app01, fileName, filePath);
data.setCode(sult);
} catch (Exception e) {
data.setCode(0);
data.setMsg("上传失败!" + e.getCause().getMessage());
} finally {
JSONObject json = JSONObject.fromObject(data);
renderJson(json.toString());
}
}
这是后台代码。