title: Tracking HttpClient.PostAsync progress using Blazor and Aspnet Webapi
body: <p>I am currently using Blazor and Asp.Net WebApi Controller to perform some file upload/download..And I have a UploadFiles() called in the Blazor client that looks like this:</p>
  <pre><code>public async Task&lt;bool&gt; UploadFiles(Action&lt;int&gt; callback, IReadOnlyList&lt;IBrowserFile&gt; files, string subdir = &quot;&quot;)
  {
      if (files != null)
      {
          var content = new MultipartFormDataContent();
          foreach (var file in files)
          {
              var fileContent = new StreamContent(file.OpenReadStream(_allowedMaxFileSize));
              content.Add(fileContent, &quot;\&quot;files\&quot;&quot;, file.Name);  
              hasItemsForUpload = true;
          }
  
          if (content != null)
          {
              var uri = $@&quot;api/mycontroller/upload?subdir=&quot; + subdir;
              var result = await _http.PostAsync(uri, content);
  
              if (result.IsSuccessStatusCode)
              {                       
                  return true;
              }
          }
      }    
  
      return false;
  }
  </code></pre>
  <p>Is there a way for me to easily track httpclient.postasync() % progress where I can pass the % as int in my callback? Note that <code>_http</code> here is injected through dependency injection registered as AddScope() of the startup.cs</p>
  <p>I've seen complicated examples using custom http content but I can't seem to wrap my head around it... :(</p>
  <p>Please help..</p>