title: Spring MVC save uploaded MultipartFile to specific folder
body: <p>I want to save uploaded images to a specific folder in a Spring 3 MVC application deployed on Tomcat</p>
  <p>My problem is that I cannot save the uploaded images files to the host where the appliciation is running.</p>
  <p>Here is what I tried:</p>
  <pre><code>private void saveFile(MultipartFile multipartFile, int id) throws Exception {
      String destination = &quot;/images/&quot; + id + &quot;/&quot;  + multipartFile.getOriginalFilename();
      File file = new File(destination);
      multipartFile.transferTo(file);
  }
  </code></pre>
  <p>Result: FileNotFoundException - Yes sure, I do want create this file!?!</p>
  <p>I tried it using the <code>context.getRealPath</code> or <code>getResources(&quot;destination&quot;)</code>, but without any success.</p>
  <p>How can I create a new file in a specific folder of my app with the content of my multipart file?</p>