I want to upload an image on user profile. I have an image in Bitmap form. I am using this 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);
I got the error The remote server returned an error: (400) Bad Request. Where am I wrong ?
 
     
    