title: Angular 2 - Image upload , File not getting uploaded to backend (no error listed)
body: <p>I am trying to upload an image in angular 2 , i have no error listed but there is no change in the position the file added detailed code is given below</p>
  
  <pre><code>**.ts**
  ............
    onFileChange(event) {
      if(event.target.files.length &gt; 0) {
        let file = event.target.files[0];
        this.fileName = file.name;
        this.imageUpload['upload'] = this.fileName;
        this.form.get('upload').setValue(file);
        console.log(file);
        console.log('filename',this.fileName);
  
  
      }
    }
  
   private prepareSave(): any {
      let inputVal = new FormData();
      inputVal.append('upload', this.form.get('upload').value,this.imageUpload['upload']);
      console.log(inputVal);
      return inputVal;
    }
  
    onSubmit() {
      this.imageUpload['upload'] = this.fileName;
      const formModel = this.prepareSave();
      this.loading = true;
  
      var body = formModel;
      let url = this.ImageUploadURL;
      let headers = new Headers({ 'Content-Type': 'multipart/form-data' ,'Authorization': 'Bearer ' + this.accountsService.accessToken });
      let options = new RequestOptions({ headers: headers });
  
      console.log(options);
      console.log(body);
      console.log(url);
      // In a real-world app you'd have a http request / service call here like
       return this.http.post(url, body, options)
            .catch(error =&gt; Observable.throw(error))
            .subscribe(
                data =&gt; console.log('success'),
                error =&gt; console.log(error)
  
          )
    }
  ...............
  </code></pre>
  
  <p>in console its getting success<a href="https://i.stack.imgur.com/yqcKE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yqcKE.png" alt="enter image description here"></a></p>
  
  <p>the method is post with url and 
  <strong>{
  upload:""
  }</strong></p>
  
  <p>In the network im getting<a href="https://i.stack.imgur.com/ijy4h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ijy4h.png" alt="enter image description here"></a></p>
  
  <p>what might be the error that there is no change on desired portion?</p>
  
  <p>is there any other way ?</p>