title: Multi File sending with HttpClient multipart/form-data
body: <p>I'm trying to post a multipart/form-data Using HttpClient</p>
  
  <p>the form requires a certain number of images.</p>
  
  <p>Code :</p>
  
  <pre><code>var client = new System.Net.Http.HttpClient();
  var content = new MultipartFormDataContent();
  var postData = new List&lt;KeyValuePair(string,string)&gt; ();
  postData.Add(new KeyValuePair &lt; string, string &gt; ("function", "picture2"));
  postData.Add(new KeyValuePair &lt; string, string &gt; ("username ", UserID));
  postData.Add(new KeyValuePair &lt; string, string &gt; ("password ", Password));
  foreach(var keyValuePair in postData) {
  content.Add(new StringContent(keyValuePair.Value),
      String.Format("\"{0}\"", keyValuePair.Key));
  }
  int x = 1;
  foreach(Bitmap item in newpics) {
  using(MemoryStream ms = new MemoryStream()) {
      item.Save(ms, ImageFormat.Bmp);
      byte[] bits = ms.ToArray();
      content.Add(new ByteArrayContent(bits), '"' + "pict" + x + '"');
      x += 1;
  }
  }
  </code></pre>
  
  <p>The problem is that only the last image is delivered !!</p>
  
  <p>why does this happen?? what did i miss? and how to fix this problem?</p>
  
  <p>Thanks in advance..</p>