title: Trying to upload MultipartFile with postman
body: <p>I am trying to upload a Multipart File using PostMan and getting errors.  Here is the code and screenshots:</p>
  
  <p><a href="http://imgur.com/pZ5cXrh" rel="nofollow">http://imgur.com/pZ5cXrh</a></p>
  
  <p><a href="http://imgur.com/NaWQceO" rel="nofollow">http://imgur.com/NaWQceO</a></p>
  
  <pre><code>@RequestMapping(value = "/upload", method = RequestMethod.POST)
  public void uploadFileHandler(@RequestParam("name") String name,
          @RequestParam("name") MultipartFile file) {
  
      if (!file.isEmpty()) {
          try {
              byte[] bytes = file.getBytes();
  
              // Creating the directory to store file
              //String rootPath = System.getProperty("catalina.home");
              String rootPath = "C:\\Desktop\\uploads";
              File dir = new File(rootPath + File.separator + "tmpFiles");
              if (!dir.exists())
                  dir.mkdirs();
  
              // Create the file on server
              File serverFile = new File(dir.getAbsolutePath()
                      + File.separator + name);
              BufferedOutputStream stream = new BufferedOutputStream(
                      new FileOutputStream(serverFile));
              stream.write(bytes);
              stream.close();
  
              System.out.println("Server File Location="
                      + serverFile.getAbsolutePath());
  
              System.out.println("You successfully uploaded file=" + name);
          } catch (Exception e) {
              System.out.println("You failed to upload " + name + " =&gt; " + e.getMessage());
          }
      } else {
          System.out.println("You failed to upload " + name
                  + " because the file was empty.");
      }
  }
  </code></pre>