title: Send image with HttpClient to POST WebApi and consume the data
body: <p>My <code>HttpClient</code> sends the image with <code>PostAsync</code>.
  I am not really sure what to do now since this is my first REST Api and I can't really adapt the things I sorted out in other posts yet.
  Hopefully you guys can help me out and can give me a direction.</p>
  
  <pre><code>public async Task SendImage(string fullFileName, string fileName)
      {            
          var client = new HttpClient();
          client.BaseAddress = new Uri("http://x.x.x.x");
  
          var content = new StringContent(fullFileName, Encoding.UTF8, "image/jpg");
          HttpResponseMessage response = await client.PostAsync($"/values/file/{fileName}", content);
      }
  </code></pre>
  
  <p>I have several questions about the POST function.
  First of all I can successfully access it with <code>PostMan</code> and the <code>fileName</code> is correct.</p>
  
  <p>How do I read the image data and write it to a file?</p>
  
  <pre><code>[HttpPost("file/{fileName}")]
  public void Upload(string fileName)
  {        
      Debug.Write(fileName);
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I setup my environment and I can now send a post via the internet to my published Web Api.
  On my app just nothing happens.
  For now I just tried to get something of a message to work on but I dont getting one.</p>
  
  <pre><code>[HttpPost("file/{fileName}")]
  public HttpResponseMessage Upload(UploadedFile fileName)
  {
      Debug.Write(fileName);
      if (!ModelState.IsValid)
      {
  
      }
      if (fileName == null)
      {
  
      }
  
      string destinationPath = Path.Combine(@"C:\", fileName.FileFullName);
      System.IO.File.WriteAllBytes(destinationPath, fileName.Data);
      HttpResponseMessage rm = new HttpResponseMessage();
      rm.StatusCode = HttpStatusCode.OK;
      return rm;
  }
  </code></pre>