title: Send javascript object with data and file to asp.net core
body: <p>I need send data with file in a <code>javascript</code> object to <code>asp.net core</code> but 
  when it arrives at the asp.net core method, arrives with null values (<code>List&lt;Upload&gt; listUpload</code>)</p>
  
  <p>I did a test removing the File property from the javascript object and it does not appear anymore null, the problem is with the File property that it can not map with the model property called File of type IFormFile.</p>
  
  <p><code>javascript</code> code:</p>
  
  <pre><code>jQuery('#tblDocuments &gt; tbody &gt; tr').each(function () {
     checkBox = jQuery(this).find('td').eq(0).children();
  
     inputFile = jQuery(this).find('td').eq(2).children()[0].files[0]; 
  
      let Upload = {
          File: inputFile,
          CodigoVendaArquivo: res,
          CodigoClienteArquivo: cliente,
          Checkbox: checkBox[0].id
      };
      listUpload.push(Upload);
  });
  </code></pre>
  
  <p>I'm trying to send with <code>fetch</code>:</p>
  
  <pre><code>fetch('../../upload', {
      method: 'POST',
      headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json'
      },
      body: JSON.stringify(listUpload)
  }).then(res =&gt; res.json())
  .then(res =&gt; {
  
      if (res == 1) {
       // success
      }
  
  });
  </code></pre>
  
  <p>Here's my <code>asp.net core</code> method:</p>
  
  <pre><code>[Route("upload")]
  [HttpPost]
  public JsonResult Upload([FromBody] List&lt;Upload&gt; listUpload)
  {
      // something
  }
  </code></pre>
  
  <p>Here's my Model:</p>
  
  <pre><code>public class Upload
  {
      public IFormFile File { get; set; }
      public string CodigoVendaArquivo { get; set; }
      public string CodigoClienteArquivo { get; set; }
      public string Checkbox { get; set; }
  }
  </code></pre>