title: Spring boot uploading files path
body: <p>I try to upload some files using <strong>Spring Boot</strong>. 
  And there is a question, where should i point path where my files will be store.
  You can see my UploadController, template and Application class bellow.</p>
  
  <pre><code>@Controller
  public class FileUploadController {
  
      @RequestMapping(value="/upload", method=RequestMethod.POST)
      public @ResponseBody String handleFileUpload(@RequestParam("name") String name,
                                                   @RequestParam("file") MultipartFile file){
          if (!file.isEmpty()) {
              try {
                  byte[] bytes = file.getBytes();
                  BufferedOutputStream stream =
                          new BufferedOutputStream(new FileOutputStream(new File(name + "-uploaded")));
                  stream.write(bytes);
                  stream.close();
                  return "You successfully uploaded " + name + " into " + name + "-uploaded !";
              } catch (Exception e) {
                  return "You failed to upload " + name + " =&gt; " + e.getMessage();
              }
          } else {
              return "You failed to upload " + name + " because the file was empty.";
          }
      }
  
  }
  </code></pre>
  
  <p>Here is my form.</p>
  
  <pre><code>&lt;div class="container"&gt;
              &lt;form method="POST" enctype="multipart/form-data"
                    action="/upload"&gt;
                  File to upload:
                  &lt;input type="file" name="file"/&gt;&lt;br/&gt; Name:
                  &lt;input
                      type="text" name="name"/&gt;&lt;br/&gt; &lt;br/&gt; &lt;input type="submit"
                                                                 value="Upload"/&gt; Press here to upload the file!
              &lt;/form&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Here is Application class.</p>
  
  <pre><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  public class Application {
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(Application.class, args);
      }
  
      @Bean
      MultipartConfigElement multipartConfigElement() {
          MultiPartConfigFactory factory = new MultiPartConfigFactory();
          factory.setMaxFileSize("128KB");
          factory.setMaxRequestSize("128KB");
          return factory.createMultipartConfig();
      }
  
  }
  </code></pre>