struts2上传文件时把文件放到服务器真实路径下的webapps\upload下
发布日期:2021-04-30 21:04:36 浏览次数:108 分类:精选文章

本文共 697 字,大约阅读时间需要 2 分钟。

????????

public String save() throws IOException{

    // ????????????????????if(uploadFileName != null){
        // ??System.out.println("?????"+uploadContentType);
        // ??????????String uuidname = UploadUtils.getUUIDName(uploadFileName);
        // ??????????String realPath = ServletActionContext.getServletContext().getRealPath("/");realPath=realPath.substring(0, realPath.indexOf("webapps"));String path = realPath+"webapps\\upload\\"+uuidname;
        // ??????File file = new File(path);
        // ????FileUtils.copyFile(upload, file);
        // ???????????customer.setFilepath(path);
        // ??????customerService.save(customer);
return "save";
}

上一篇:DDD专栏开篇词:关于DDD
下一篇:Javascript复习(三)

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2026年05月29日 01时54分30秒