title: Upload multiple files in a single HTTPWebRequest
body: <p>I have created a service which accept 2 things :</p>
  
  <p>1) A body parameter called "type".</p>
  
  <p>2) A csv file to be uploaded.</p>
  
  <p>i am reading this two things in server side like this: </p>
  
  <pre><code> //Read body params
   string type = HttpContext.Current.Request.Form["type"];
  
   //read uploaded csv file
   Stream csvStream = HttpContext.Current.Request.Files[0].InputStream;
  </code></pre>
  
  <p>how can i test this, i am using <strong>Fiddler</strong> to test this but i can send only one thing at a time(either type or file), because both things are of different content type, how can i use content type <strong>multipart/form-data</strong> and <strong>application/x-www-form-urlencoded</strong> at same time.</p>
  
  <p>Even i use this code </p>
  
  <pre><code>    public static void PostDataCSV()
      {
          //open the sample csv file
          byte[] fileToSend = File.ReadAllBytes(@"C:\SampleData.csv"); 
  
          string url = "http://localhost/upload.xml";
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
          request.Method = "POST";
          request.ContentType = "multipart/form-data";
          request.ContentLength = fileToSend.Length;
  
  
          using (Stream requestStream = request.GetRequestStream())
          {
              // Send the file as body request. 
              requestStream.Write(fileToSend, 0, fileToSend.Length);
              requestStream.Close();
          }
  
          HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  
          //read the response
          string result;
          using (StreamReader reader = new StreamReader(response.GetResponseStream()))
          {
              result = reader.ReadToEnd();
          }
  
          Console.WriteLine(result);
      }
  </code></pre>
  
  <p>This also not sending any file to server.</p>