title: PhoneGap Upload images to Server by restfull WS (Server side processing off data)
body: <p>I am trying to upload image from my PhoneGap application to some folder on server. I have restful WS on my server side with following method:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json,  UriTemplate = "fileUpload")]
      string fileUpload(Stream fileStream); 
  
  
  public string fileUpload(Stream fileStream)
           {
           try
               {
               FileStream fileToupload = new FileStream("D:\\FileUpload\\" + "images.jpg", FileMode.Create);
  
               byte[] bytearray = new byte[10000];
               int bytesRead, totalBytesRead = 0;
               do
                   {
                   bytesRead = fileStream.Read(bytearray, 0, bytearray.Length);
                   totalBytesRead += bytesRead;
                   } while (bytesRead &gt; 0);
  
               fileToupload.Write(bytearray, 0, bytearray.Length);
               fileToupload.Close();
               fileToupload.Dispose();
  
               return "Success;
  
               }
           catch (Exception e)
               {
               return e.Message;
               throw (e);
               }                   
           }
  </code></pre>
  
  <p>I used the most common example from <a href="http://docs.phonegap.com/en/2.3.0/cordova_file_file.md.html#FileUploadOptions" rel="nofollow">http://docs.phonegap.com/en/2.3.0/cordova_file_file.md.html#FileUploadOptions</a>  and it is uploads images on the right place and gives me success call, but I cannot open image after it, "windows viewer" says "damaged, corrupted or is to large". 
  When I open image in notepad++ i have following text on the begging off image:</p>
  
  <pre><code>--*****
  Content-Disposition: form-data; name="value1";
  
  test
  --*****
  Content-Disposition: form-data; name="value2";
  
  param
  --*****
  Content-Disposition: form-data; name="file"; filename="32"
  Content-Type: image/jpeg
  </code></pre>
  
  <p>When I delete these part, I get original correct image.
  How to proceed these data on my server side. I wanna pull out image name and parameters and use it as a string, and push only image content to my image without these parameters?</p>
  
  <p>Thanks,
  Milos </p>