java 上传 MultipartFile attach 获取不到信息 用的是 dropzone.js
伊谢尔伦
伊谢尔伦 2017-04-17 11:53:56
0
0
637

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

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

membalas semua(0)
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!