写注册页面上传的图片发现Element的Upload上传-->用户头像上传,使用servlet获取不到图片文件。

转而使用 <input type="file"> 上传并使用<label>展示图片内容。

https://blog.csdn.net/weixin_43458965/article/details/113243599

https://blog.csdn.net/qq_45116737/article/details/114095958

给用到的servlet添加注解

@MultipartConfig(
        maxFileSize = 1024*1024+10,
        maxRequestSize = 1024*1024*30,
        fileSizeThreshold = 0,//小:内存,大:硬盘
        location = ""
)

dopost方法里获取对象

Part file=request.getPart("file");
 //地址
String diskpath;
if (file.getSize() != 0) {
                diskpath="D:/KFImgs/head_img"+phone+".jpg";
                System.out.println(diskpath);
                file.write((diskpath));
            }