title: FormData and send image in Angular 9 and ASP.NET Core 2.1
body: <p>I want to send the form information to the server, which also includes a photo, I send it correctly when sending, but the file is empty on the server side.</p>
  <p>HTML:</p>
  <pre><code>&lt;form [formGroup]=&quot;add&quot; (ngSubmit)=&quot;submit()&quot;&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;file&quot;&gt;File&lt;/label&gt;
          &lt;input type=&quot;file&quot; class=&quot;form-control&quot; (change)=&quot;onFileChange($event)&quot;&gt;
      &lt;/div&gt;
      &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Typescript:</p>
  <pre><code>imageSrc: string;
    add = new FormGroup({
      userName: new FormControl('Aliakbar', Validators.required),
      password: new FormControl('123', Validators.required),
      roleId: new FormControl('3', Validators.required),
      email: new FormControl('aliakbar@gmail.com', Validators.required),
      number: new FormControl('12344456785', Validators.required)
    });
    fileMe:File;
    onFileChange(file) {
      this.fileMe=file.target.files[0];
    }
    submit() {
      this._service.postDataUserTest(this.add.value,this.fileMe);
    }
  </code></pre>
  <p>Service:</p>
  <pre><code>  postDataUserTest(user: IUserTest, fileUpload: File) {
      const formData: any = new FormData();
      formData.append('file', fileUpload, fileUpload.name);
      formData.append('userName', user.userName);
      formData.append('password', user.password);
      formData.append('email', user.email);
      formData.append('number', user.number);
      formData.append('roleId', user.roleId);
  
      this.http.post(this.urlUser, formData).subscribe(
        (response) =&gt; console.log(response),
        (error) =&gt; console.log(error))
    }
  </code></pre>
  <p>ASP.NET Core 2.1 (Server):</p>
  <pre><code>public IActionResult Create([FromForm] user vUser, [FromForm] IFormFile file)
  {
      .....
  }
  </code></pre>
  <p>When the file is received, it is set to null.</p>
  <p>How do I send the image?</p>