title: how to upload a pdf file and other string parameter in rest wcf service
body: <p>I had created a rest wcf service and now i want to post the pdf file and some other string data to it so what is the Correct way to do it</p>
  
  <p>1) converting the pdf to base64 string and then form the xml and post it to rest web service decode it in the rest service.<br></p>
  
  <p>2) directly uploading using the below code<br></p>
  
  <pre><code>     byte[] pdfFile = File.ReadAllBytes("pdf file path here");WebRequest request = WebRequest.Create("https://test.site.fr/Testfile");
      request.Method = "POST";
      request.ContentLength = pdfFile.Length;
      request.ContentType = "application/pdf";
  
      Stream stream = request.GetRequestStream();
      stream.Write(pdfFile, 0, pdfFile.Length);
      stream.Close();
  
      HttpWebResponse response = (HttpWebResponse)request.GetResponse();
      StreamReader reader = new StreamReader(response.GetResponseStream());
      Console.WriteLine(reader.ReadToEnd());
      reader.Close();
  </code></pre>
  
  <p>which is better with respect to large files and if any other compression required </p>