首页  >  问答  >  正文

java 上传 MultipartFile attach 获取不到信息 用的是 dropzone.js

java 上传 MultipartFile attach 获取不到信息

attach怎么为空

@RequestMapping(value="/upload", method=RequestMethod.POST, produces="application/json;charset=UTF-8")
@ResponseBody
public String upload(Model model, @RequestParam("attach") MultipartFile attach, HttpServletRequest req, HttpSession session) throws IOException {

    System.out.println("Name:"+attach.getName());
    System.out.println("ContentType:"+attach.getContentType());
    System.out.println("OriginalFilename:"+attach.getOriginalFilename());
    System.out.println("Size:"+attach.getSize());
    System.out.println("Bytes:"+attach.getBytes());
    System.out.println("Class:"+attach.getClass());
    System.out.println("InputStream:"+attach.getInputStream());


    return null;
}

前面全部是空。空子真异常

搞定,应该这么写:@RequestParam("file") MultipartFile file

伊谢尔伦伊谢尔伦2761 天前641

全部回复(0)我来回复

暂无回复
  • 取消回复