title: save file with different name in spring boot
body: <p>I am uploading one file that is kind of multipart. I want this file to save with different name. </p>
  
  <ol>
  <li>tried with renameTo method but did not work.</li>
  <li>tried moveto but did not work</li>
  </ol>
  
  <p>below is my code
  here graphic is multipart file</p>
  
  <pre><code>String picName     = graphic.getOriginalFilename();EN_LENGTH) + "." + graphic.getContentType();
          Path   dirLocation = Paths.get(dirPath);
          String newName = CommonUtil.getToken(Constants.STANDRAD_TOKEN_LENGTH) + "." + graphic.getContentType();
          try {
              InputStream is = graphic.getInputStream();
              Files.copy(is, dirLocation.resolve(picName), StandardCopyOption.REPLACE_EXISTING);
              boolean a = new File(dirLocation+picName).renameTo(new File(dirLocation+newName));
  </code></pre>
  
  <p>for security reasons I want it to save with different name.</p>