springboot保存文件

if(!headerImg.isEmpty()){
        //保存文件到服务器,
        String originaFilename = headerImg.getOriginalFilename();
        headerImg.transferTo(new File("D:\\cache\\"+ originaFilename );
}
if(!headerImg.isEmpty()){
        //保存文件到服务器,
        String originaFilename = headerImg.getOriginalFilename();
        headerImg.transferTo(new File("D:\\cache\\"+ originaFilename );
}
if(!headerImg.isEmpty()){
        //保存文件到服务器,
        String originaFilename = headerImg.getOriginalFilename();
        headerImg.transferTo(new File("D:\\cache\\"+ originaFilename );
}

 

posted @ 2022-01-06 10:58  帅超007  阅读(823)  评论(0编辑  收藏  举报