2021年3月24日星期三

How to upload all files of a directory using java spring

i have files in a directory and i want to upload all these files in client side into folder in server side. here is my controller:

private static ArrayList<String> listFilesforFolder(final File folder) {      ArrayList<String> arrFile = new ArrayList<String>();      for (final File fileEntry : folder.listFiles()) {          if (fileEntry.isDirectory()) {              listFilesforFolder(fileEntry);          } else {              arrFile.add(fileEntry.getName());          }      }      return arrFile;  }    @GetMapping("/scanfolder")  @ResponseBody  public static void scanFolder(String[] args) throws IOException {        logger.info(docs);      if (!docs.isEmpty()) {          // how to upload that file in folder automatically to server      }  }  

so i can send request command from client side to server execute upload all files to different folder. I'm so appreciate if have suggestion/tutorial/article to make this.

https://stackoverflow.com/questions/66792922/how-to-upload-all-files-of-a-directory-using-java-spring March 25, 2021 at 12:05PM

没有评论:

发表评论