我正在使用此代码将图像文件发布到我的控制器,但我总是得到文件正文部分的空值。
@RequestMapping(value = "/updateprofile", method = RequestMethod.POST)
public @ResponseBody
ResponseMsg updateProfile(
@RequestHeader(value = "userid", required = false) String userid,
@RequestHeader(value = "name", required = false) String name,
@RequestHeader(value = "phone", required = false) int phone,
@RequestParam(value = "file", required = false) MultipartFile file) {
ResponseMsg responseMsg = CommonUtils.checkParam(userid, name, phone,
file);
if (responseMsg.getStatus().equalsIgnoreCase("True"))
responseMsg = userService.login(name, userid);
return responseMsg;
}
有人能帮忙吗?