ホームページ  >  に質問  >  本文

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日前642

全員に返信(0)返信します

応答なし
  • キャンセル返事