title: How to send Image to Spring API using Symfony 2.8?
body: <p>I have been working in a project that receive an image and returns a list with the most similar that I have in Solr. I have tested the service using <a href="https://www.getpostman.com/" rel="nofollow noreferrer">Postman</a> but I want to make a client using Symfony 2.8 to use the service. I googled a lot and nothing specific found.
  My method with Spring should receive a MultipartFile and store it, then another method will process that image...
  Here is the code of my uploadFile method. Any help of how to do this with Symfony? Thanks!</p>
  
  <p>Sorry for my English!</p>
  
  <pre><code>@PostMapping("/")
  public ResponseEntity&lt;String&gt; handleFileUpload(@RequestParam("file") MultipartFile file) {
      String message = "";
      try {
          String extension = storage.getExtension(file.getOriginalFilename());
          if (extension.equals("jpg") || extension.equals("JPG") || extension.equals("jpeg") || extension.equals("png")) {
              storage.store(file);
              storage.copyImage("upload-dir/" + storage.getFile(rootLocation.toFile()));
              return ResponseEntity.status(HttpStatus.OK).body(null);
          } else {
              message = "El archivo " + file.getOriginalFilename() + " no es una imagen.";
              return ResponseEntity.status(HttpStatus.OK).body(message);
          }
      } catch (Exception e){
          message = "Falló la subida";
          return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(message);
      }
  
  
  }
  </code></pre>