title: file upload works with postman but not with angular2
body: <p>I am quite new to Angular 2, please consider it.</p>
  
  <p>I am facing a problem with uploading a file to the node server using angular 2. It works fine using postman:</p>
  
  <p><strong>Postman snapshot:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/CU23M.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>However, when I use the Angular2 application to send a file to the server, it does nothing:</p>
  
  <p><strong>Angular HTML Component</strong> </p>
  
  <pre><code>&lt;label for="file1"&gt;Upload PDF version: &lt;/label&gt;
  &lt;form class="form-inline"&gt;
      &lt;div class="form-group"&gt;
          &lt;input type="file" id="file1" #abc name="fileToUpload"  class="form-control" placeholder="Upload PDF"&gt;
      &lt;/div&gt;
      &lt;button class="btn btn-primary" type="submit" (click)="onUpload(abc)"&gt;Upload&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Angular TS component:</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { UploadService } from './upload.service';
  import { NgForm } from '@angular/forms';
  
  @Component({
    selector: 'app-upload',
    templateUrl: './upload.component.html',
    styleUrls: ['./upload.component.css']
  })
  export class UploadComponent implements OnInit {
  
    // file1 = document.getElementById("file1");
    constructor(private uploadService: UploadService) { }
  
    ngOnInit() {
    }
  
    onUpload = (file: File) =&gt; {
      this.uploadService.uploadfile(file)
        .subscribe((res) =&gt; {
          console.log(res);
        },
  
          (err) =&gt; {
            console.log(err);
          });
    }
  
  }
  </code></pre>
  
  <p><strong>Service component:</strong></p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Observable } from 'rxjs/Observable';
  import { HttpClient } from '@angular/common/http';
  
  
  @Injectable()
  export class UploadService {
  
    constructor(private http: HttpClient) {
    }
  
    uploadfile(file: File): Observable&lt;File&gt; {
  
      console.log(file);
      return this.http.post&lt;File&gt;("http://localhost:3000/fileupload", file, { headers: { 'Content-Type': 'application/json' } });
    }
  
  }
  </code></pre>
  
  <p>Of course, I must be missing something here. I request you all, to please provide some solution.</p>