title: to post image file in windows phone 7 application
body: <p>I am developing an application for windows phone 7.From here I want to upload an image file  to the remote server.I am using the following code to receive the file at my receiving end:</p>
  
  <pre><code>if (Request.Files.Count &gt; 0)
  {
      string UserName = Request.QueryString["SomeString"].ToString();
      HttpFileCollection MyFilecollection = Request.Files;           
      string ImageName = System.Guid.NewGuid().ToString() + MyFilecollection[0].FileName;   
      MyFilecollection[0].SaveAs(Server.MapPath("~/Images/" + ImageName));
  } 
  </code></pre>
  
  <p>Now my problem is, how can I post the file from my windows phone 7 platform (using PhotoChooserTask).I have tried the following code but with no success.(the following code is called from the PhotoChooserTask completed event handler.</p>
  
  <pre><code>private void UploadFile(string fileName, Stream data)
  {
      char[] ch=new char[1];
      ch[0] = '\\';
      string [] flname=fileName.Split(ch);
  
      UriBuilder ub = new UriBuilder("http://www.Mywebsite.com?SomeString="+ussi );
      ub.Query = string.Format("name={0}", flname[6]);
      WebClient c = new WebClient();
      c.OpenWriteCompleted += (sender, e) =&gt;
      {
          PushData(data, e.Result);
          e.Result.Close();
          data.Close();
      };
      c.OpenWriteAsync(ub.Uri);
  }
  
  private void PushData(Stream input, Stream output)
  {
      byte[] buffer = new byte[4096];
      int bytesRead;
      while ((bytesRead = input.Read(buffer, 0, buffer.Length)) != 0)
      {
          output.Write(buffer, 0, bytesRead);
      }
  }
  </code></pre>
  
  <p>Please help me out to get out from this problem.
  Thanks</p>