Skip to content

Commit a22bfab

Browse files
committed
copy file to local disk
copy file to local disk added!
1 parent d478824 commit a22bfab

File tree

1 file changed

+4
-0
lines changed
  • spring-mvc-jquery-file-upload/src/main/java/com/hmkcode/spring/mvc/controllers

1 file changed

+4
-0
lines changed

spring-mvc-jquery-file-upload/src/main/java/com/hmkcode/spring/mvc/controllers/FileController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public class FileController {
5757

5858
try {
5959
fileMeta.setBytes(mpf.getBytes());
60+
61+
// copy file to local disk (make sure the path "e.g. D:/temp/files" exists)
62+
FileCopyUtils.copy(mpf.getBytes(), new FileOutputStream("D:/temp/files/"+mpf.getOriginalFilename()));
63+
6064
} catch (IOException e) {
6165
// TODO Auto-generated catch block
6266
e.printStackTrace();

0 commit comments

Comments
 (0)