赞
踩
当采用Postman方式上传文件,出现空指针错误
解决方案
public String upLoadFile(@RequestParam("file") MultipartFile multipartFile)
加上@RequestParam(“file”)注解,以及在postman中Header中设置key=Content-Type,value=multipart/form-data
再次运行,上传文件成功。
这里说明下@RequestParam参数里面为什么用"file",是因为postman中Body中key值为file
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。