if (!"POST".equals(request.getMethod())) {
response.sendRedirect(buildRecirectPath(request, "/album/bupload/" + albumIdStr, null));
}
long userId = Long.parseLong(userIdStr);
long albumId = Long.parseLong(albumIdStr);
MultipartFile file = ((MultipartHttpServletRequest) request).getFile("file");
// 本地存放路径生成
if (file == null) {
Map<String, Object> jsonMap = resultToJsonMap(ResultState.NO_FILE_EXIST, null);
OutputStream out = response.getOutputStream();
outputJsonResult(out, jsonMap);
return;
}
File localFile = generateLocalFile(userId, albumId, file.getOriginalFilename());
// 保存文件
ResultState result = storeFileInLocal(localFile, file);
// 输出结果
Map<String, Object> jsonMap = resultToJsonMap(result, localFile.getAbsolutePath());
OutputStream out = response.getOutputStream();