当我尝试使用Java上传文件时出现此错误,系统找不到指定的文件tmp

问题描述

我正在现金C驱动器中生成一个temp文件,它仅生成一个文件,而第二个文件生成,并且出现此错误

系统找不到指定的文件(tmp)*

InputStream inputStrJw = null;
inputStrJw = this.videoLinkEntertainment.getInputstream();
File destFileJw = new File("D:\\Program Files\\Apache Software Foundation\\Tomcat 9.0\\webapps\\movies\\" + this.gener + "\\" + fileNameVideo);
FileUtils.copyInputStreamToFile(inputStrJw,destFileJw);
this.Generatedpath = "D:\\Program Files\\Apache Software Foundation\\Tomcat 9.0\\webapps\\movies\\" + this.gener + "\\" + fileNameVideo;

inputStrJw.close();

InputStream inputStrJw2 = null;
inputStrJw2 = this.coverImageEntertainment.getInputstream();
File destFileJw2 = new File("D:\\Program Files\\Apache Software Foundation\\Tomcat 9.0\\webapps\\movies\\" + this.gener + "\\" + fileNameImage);
FileUtils.copyInputStreamToFile(inputStrJw2,destFileJw2);
this.GeneratedpathForImage = "D:\\Program Files\\Apache Software Foundation\\Tomcat 9.0\\webapps\\movies\\" + this.gener + "\\" + fileNameImage;

inputStrJw2.close();

解决方法

尝试打印目录中的所有文件,以查看文件是否已列出

File file = new File(".");
for(String aFile : file.list()) System.out.println(aFile);