This is my angular code 

```
let fileToUpload = this.profilePhotoFiles[0];
      let formData: FormData = new FormData();
      formData.append('file', fileToUpload, fileToUpload.name);

      this._http.post('/api/Media/upload', formData , {
        headers: {
          'Accept': 'application/json',
          'Content-Type': fileToUpload.type,
          'Content-Disposition' : 'multipart/form-data'
        }
      })
        .subscribe(r => console.log(r));

```

This is how my api implement,

```
        [HttpPost]
        [Route("upload")]
        public IActionResult UpdatePicture([FromForm(Name = "file")] IFormFile file)
        {
            if (file == null)
                return StatusCode(500);
            //...............myUploadingCode
            return Ok();
        }

```

Url and Authentication are fine and correct. But it returns code **401** and can't get to API method `UpdatePicture`.  

How can I solve it? What did I miss here?

**Edit**

This is how I get formData of uploaded photo

```
  let formData: FormData = new FormData();
  formData.append('file', fileToUpload, fileToUpload.name);

```

**Update 1**

after `Authorization` header like

```
        this.headers = this.headers.append('Authorization', myTokenValue);

```

It passes `401 unauthorize` but it returns 415 unsupported formats.

**Update 2**

And after I added

```
        this.headers = this.headers.set('Content-Disposition', 'multipart/form-data');

```

It passes code 415 but in API controller, but the parameter `IFormFile file` is null.

Reference from [this](https://stackoverflow.com/q/55008484/1427849) question.