您当前的位置: 首页 >  servlet

txwtech

暂无认证

  • 0浏览

    0关注

    813博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

The method getRealPath(String) from the type ServletRequest is deprecated

txwtech 发布时间:2018-08-01 22:55:31 ,浏览量:0

File tempFile = new File(fileName);// 构造临时对象       // String savePath=tempFile.getName();       // //返回上传文件在客户端的完整路径名称       // request.setAttribute("filename", savePath);

//File file = new File(request.getRealPath("/upload"), //此句报错。       File file = new File(request.getSession().getServletContext().getRealPath("/upload"),//改成这句。就Ok咯         tempFile.getName()); // 获取根目录对应的真实物理路径

关注
打赏
1665060526
查看更多评论
立即登录/注册

微信扫码登录

0.0647s