title: How to upload files with react to my .net server
body: <p>How do I upload images to my server. I am using react and so far my controller looks like this:</p>
  
  <pre><code> [Authorize]
   public object UploadAvatar()
  {
              var file = HttpContext.Current.Request.Files.Count &gt; 0 ? HttpContext.Current.Request.Files[0] : null;
  }
  </code></pre>
  
  <p>file shows = null when I am upload with react and axios:</p>
  
  <pre><code>const URL = '/api/userapi/uploadavatar';
  var reader = new FileReader();
  var file = e.target.files[0];
  reader.readAsDataURL(file);
  reader.onload = (upload) =&gt; {
    console.log(upload.target.result);
    axios.post(URL, {
      data: upload.target.result
    }, config);
  }
  </code></pre>
  
  <p><strong>But when i upload with postman it works fine</strong></p>