2024-04-13 00:56:37
String path =ServletActionContext.getServletContext().getRealPath("/")+ this.getDestPath()+"\\"+ getFileFileName();
FileInputStream fin = new FileInputStream(file); FileOutputStream fout = new FileOutputStream(path);
byte [] buffer = new byte [BUFFER_SIZE];
while (fin.read(buffer) > 0 ) {
fout.write(buffer);
}
path还是Tomcat的路径
确实是啊 你调用的方法不就是 调用 application的真实路径么 当然是 webapp/...... TomCat的项目路径啊。
你在输出流的时候写一个指定的 File 不就行了。然后对这个新建的 file 进行操作就可以了啊
File f= new File("c://newfile/my_file.txt");
然后输出流往这里写就行啊
2024-04-13 00:31:00
2024-04-13 05:19:05
String path =ServletActionContext.getServletContext().getRealPath("/")+ this.getDestPath()+"\\"+ getFileFileName();
FileInputStream fin = new FileInputStream(file); FileOutputStream fout = new FileOutputStream(path);
byte [] buffer = new byte [BUFFER_SIZE];
while (fin.read(buffer) > 0 ) {
fout.write(buffer);
}
path还是Tomcat的路径