title: HttpClient Download Image From URL Then Upload Image
body: <p>I have an image that sits in a url.</p>
  <p>https://somecdn/content/myimage.png</p>
  <p>I want to pass this string to my API,Download the image into memory then upload to another API.</p>
  <p>I'm using an api client that is generated from our swagger that takes a type of IO.stream.</p>
  <p>Code is as follows:</p>
  <pre><code>    public async Task&lt;int&gt; UploadPicture(string fileUrl)
      {
          
          var otherApiClient = await _otherApiClient.Build();
          var fileRetrievalClient = new HttpClient();           
  
          var fileResponse = await fileRetrievalClient.GetAsync(fileUrl);
          
  
          var newId = await otherApiClient.UploadPictureAsync(file: await fileResponse.Content.ReadAsStreamAsync());
  
          return newId;
      }
  </code></pre>
  <p>Normally when this is called via the front end the types are set correctly correctly:</p>
  <p><em>Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;yadayada.png&quot;
  Content-Type: image/png</em></p>
  <p>However in my code the Content-Type is wrong:</p>
  <p><em>Content-Type: <strong>application/octet-stream</strong>
  Content-Disposition: form-data; name=file; filename=<strong>unknown</strong></em></p>
  <p>How can I correct this?</p>