java spring mvc找不到上载的文件
我已经搜索了tomcat 8.0目录和它的子目录,但找不到上传的文件,该文件已成功上传 这是我的上传代码:java spring mvc找不到上载的文件,java,spring-mvc,tomcat,Java,Spring Mvc,Tomcat,我已经搜索了tomcat 8.0目录和它的子目录,但找不到上传的文件,该文件已成功上传 这是我的上传代码: File folder = new File("Uploads"); if(!folder.exists()){ folder.mkdirs(); } BufferedOutputStream buff =new BufferedOutputStream(new FileOutputStream(folder+File.separator+f.get
File folder = new File("Uploads");
if(!folder.exists()){
folder.mkdirs();
}
BufferedOutputStream buff =new BufferedOutputStream(new FileOutputStream(folder+File.separator+f.getName()));
buff.write(f.getFile().getBytes());
buff.flush();
buff.close();
link = folder + File.separator + f.getName();
}
catch(IOException es){
logger.info("error "+es.getMessage());
}
正如Balaji所建议的,执行一个简单的文件夹.getAbsolutePath()显示它存储在sts/sts version/目录中。尝试打印到console/log Folder.getAbsolutePath()并检查该目录!非常感谢,巴拉吉