title: How to upload image on facebook using graph api?
body: <p>I want to upload an image on user profile. I have an image in <code>Bitmap</code> form. I am using this code...</p>
  
  <pre><code>        Bitmap bit = new Bitmap("E:\\abc.jpg");
          MemoryStream ms = new MemoryStream();
  
          bit.Save(ms, ImageFormat.Jpeg);
  
          byte[] buffer = ms.ToArray();
  
  
          HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/me/photos?access_token=" + acc_token);
  
          req.Method = "POST";
          req.ContentLength = buffer.Length;
          //req.ContentType = "application/x-www-form-urlencoded";
          req.ContentType = "image/jpeg";                       
  
          Stream rq_strm = req.GetRequestStream();
          rq_strm.Write(buffer, 0, buffer.Length);
          rq_strm.Close();
  
          HttpWebResponse res = (HttpWebResponse)req.GetResponse();     //got error here
          Response.Write("RESPONSE: " + res.StatusDescription);
  </code></pre>
  
  <p>I got the error <code>The remote server returned an error: (400) Bad Request.</code> Where am I wrong ?</p>