title: File upload not working using generated client code
body: <p>I have got a simple <code>input</code> for selecting a file from the local drive:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;input type="file" (change)="onUpload($event)" required/&gt;
  </code></pre>
  
  <p>After selecting a file, I want to upload it to my server.</p>
  
  <p>For this I am using actually a generated client which exposes the interface:</p>
  
  <pre class="lang-js prettyprint-override"><code>// Generated Client Code
  
  // .. file.d.ts
  export interface File {
      file?: Blob;
  }
  
  // .. rest-client.d.ts
  
  postTrack(file, observe = 'body', reportProgress = false) {
      if (file === null || file === undefined) {
          throw new Error('Required parameter file was null or undefined when calling postTrack.');
      }
      let queryParameters = new HttpParams({ encoder: this.encoder });
      if (file !== undefined &amp;&amp; file !== null) {
          queryParameters = queryParameters.set('file', file);
      }
      let headers = this.defaultHeaders;
      // to determine the Accept header
      const httpHeaderAccepts = [
          'multipart/form-data'
      ];
      const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
      if (httpHeaderAcceptSelected !== undefined) {
          headers = headers.set('Accept', httpHeaderAcceptSelected);
      }
      return this.httpClient.post(`${this.configuration.basePath}/api/tracks`, null, {
          params: queryParameters,
          withCredentials: this.configuration.withCredentials,
          headers: headers,
          observe: observe,
          reportProgress: reportProgress
      });
  }
  </code></pre>
  
  <p>The upload looks like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>onUpload(event) {
    this.uploadAndProgress(event.target.files);
  }
  
  uploadAndProgress(files: File[]) {
  
    // Method 1 - Pass file object directly
    const file = files[0];
  
    // Method 2 - Append file object to FormData     
    const file = new FormData();
    file.append('file', files[0]);
  
    this.apiGateway.postTrack(file, 'events',true)
      .subscribe((event) =&gt; {
        if (event.type === HttpEventType.UploadProgress) {
          this.percentDone = Math.round(100 * event.loaded / event.total);
        } else if (event instanceof HttpResponse) {
          this.uploadSuccess = true;
        }
      });
  }
  </code></pre>
  
  <p>However, it is not working as the POST reqest URL looks like this: <a href="https://localhost:8443/api/tracks?file=%5Bobject%20Object%5D" rel="nofollow noreferrer">https://localhost:8443/api/tracks?file=%5Bobject%20Object%5D</a> (for Method 1 and Method 2) and I am getting this response:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "timestamp": "2020-01-25T22:16:27.727+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "Current request is not a multipart request",
    "trace": "org.springframework.web.multipart.MultipartException: Current request is not a multipart request\n...",
    "path": "/api/tracks"
  }
  </code></pre>
  
  <p>On the server side I am having this endpoint which is currently responsible for storing that file elsewhere:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RequestMapping(value = "/tracks", method = RequestMethod.POST, consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
  public @ResponseBody
  String postTrack(
          @RequestParam("file") MultipartFile file,
          RedirectAttributes redirectAttributes
  ) {
      storageService.store(file);
      redirectAttributes.addFlashAttribute("message",
              "You successfully uploaded " + file.getOriginalFilename() + "!");
  
      return "redirect:/";
  }
  </code></pre>
  
  <p>I am not quite sure what exactly I have to do to make this work.</p>
  
  <p>I'm pretty sure the issue is that I am supposed to send the file as a <code>Blob</code>. However, I couldn't find a way to transform the <code>File</code> object to a <code>Blob</code>.</p>