You need to pass the Image in a POST request to the Graph API (Need publish_stream permission). What is mentioned in Facebook Documentation is correct. Following is the example code that may do the work.
Use it inside a method. (Code is in C#).
You need to pass the Image in a POST request to the Graph API (Need publish_stream permission). What is mentioned in Facebook Documentation is correct. Following is the example code that may do the work.
Use it inside a method. (Code is in C#) Legend : you need to provide the info. Update Please post comments to improve the code.
String ImageData; string queryString = string. Concat("access_token=", /**/); string boundary = DateTime.Now.Ticks. ToString("x", CultureInfo.
InvariantCulture); StringBuilder sb = String. Empty; sb. Append("----------").
Append(boundary). Append("\r\n"); sb. Append("Content-Disposition: form-data; filename=\"").
Append(/**/). Append("\""). Append("\r\n"); sb.
Append("Content-Type: "). Append(String. Format("Image/{0}"/**/)).
Append("\r\n"). Append("\r\n"); using (FileInfo file = new FileInfo("/**/")) { ImageData = file.OpenText().ReadToEnd(); } byte postHeaderBytes = Encoding. UTF8.
GetBytes(sb.ToString()); byte fileData = Encoding. UTF8. GetBytes(ImageData); byte boundaryBytes = Encoding.
UTF8. GetBytes(String. Concat("\r\n", "----------", boundary, "----------", "\r\n")); var postdata = new bytepostHeaderBytes.
Length + fileData. Length + boundaryBytes. Length; Buffer.
BlockCopy(postHeaderBytes, 0, postData, 0, postHeaderBytes. Length); Buffer. BlockCopy(fileData, 0, postData, postHeaderBytes.
Length, fileData. Length); Buffer. BlockCopy(boundaryBytes, 0, postData, postHeaderBytes.
Length + fileData. Length, boundaryBytes. Length); var requestUri = new UriBuilder("https://graph.facebook.Com/me/photos"); requestUri.
Query = queryString; var request = (HttpWebRequest)HttpWebRequest. Create(requestUri. Uri); request.
Method = "POST"; request. ContentType = String. Concat("multipart/form-data; boundary=", boundary); request.
ContentLength = postData. Length; using (var dataStream = request. GetRequestStream()) { dataStream.
Write(postData, 0, postData. Length); } request.GetResponse().
I finally got around to trying this out but I got the same "The remote server returned an error: (400) Bad Request. " that i've gotten with the other methods. I noticed that you declared the request variable twice, vb.net didn't like that.
– user548084 Jan 7 '11 at 4:47 oh yeah sorry I just edited that.. and for your problem... are you sure you are using a valid access token (with publish stream Extended permission).. because that error normally returned when you don't have a valid access token. Try using that uri with access token in a browser (GET) request do you still get an error... – Shekhar_Pro Jan 7 '11 at 6:43.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.