Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8505273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:16:18+00:00 2026-06-11T02:16:18+00:00

please provide me a simple piece of code in c# to post photo on

  • 0

please provide me a simple piece of code in c# to post photo on facebook without using the very famous facebook sdk for c#, as per my knowledge there are two methods of posting photos,

METHOD 1:

The fb documentation below shows a method to post image with the url provided,

https://developers.facebook.com/blog/post/526/?ref=nf

of course I tried, it does not seem to accept my image url, when I tried debugging here on facebook API explorer using the post method and entered the parameters as below,

SomeAlbumID/photos?=access_token=MyTOKEN&url=http%3a%2f%2fcutree.com%2fcutreefbapp%2fimg1.bmp&message=Family+Tree

It returns an exception saying

{
  "error": {
    "message": "http\u00253a\u00252f\u00252fcutree.com\u00252fcutreefbapp\u00252fimg1.bmp is an internal url, but this is an external request.", 
    "type": "CurlUrlInvalidException"
  }
}

“internal url, but this is an external request.” I am not sure what this means as I am using the same domain as registered on my fbapp, and also giving the request from the server itself.

I have read some where that fb accepts images from only a few servers, can anyone help me out.

METHOD 2:

This is a method where image data in bytes are atttached with the Post body as fb says “To publish a photo, issue a POST request with the photo file attachment as multipart/form-data.”

However everyone does that using the fb sdk for c#, can anyone provide simple http post method for this issue.

I have tried streaming image data using a method below

public MyFacebookClass FBPost(string URI, string Parameters)
{
    System.Net.WebRequest req = System.Net.WebRequest.Create("https://graph.facebook.com/" + URI);
    req.ContentType = "application/x-www-form-urlencoded";
    req.Method = "POST";
    byte[] bytes = BmpToBytes_Serialization(new Bitmap("C:\\Users\\atul\\cutreefbapp\\DefaultThumb.bmp"));
    req.ContentLength = bytes.Length;
    System.IO.Stream os = req.GetRequestStream();
    os.Write(bytes, 0, bytes.Length); 
    os.Close();
    System.Net.WebResponse resp = req.GetResponse();
    if (resp == null) return null;
    System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
    return new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<MyFacebookClass>(sr.ReadToEnd().Trim());

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:16:20+00:00Added an answer on June 11, 2026 at 2:16 am

    The problem you have is your code isn’t correct. In order to post a photo to Facebook you’ll need to use a multi-part form data post. I haven’t used the C# SDK, but I’m sure it builds a multi-part form post internally before submitting the image.

    You will have to do something similar to what is posted here. I was about to post my code that does this exactly for Facebook from my app, but it is a bit long.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please provide a simple example of how to consume a REST service
I'm new to this kabeja package so please can some one provide code example
Can someone please provide a simple example of what would cause a Git push
Please provide some code for converting char[] array of decimal values to bytes array
Please provide a good, thorough tutorial about Java class loading , focusing on how
Please provide the diff b/w ref and out parameters in C#
please provide me the possibility of my issue. Can we customize the push notification
Can someone please provide an example of how to store, and read xml data
Has anybody used OProfile tool on android...If you are able to profile please provide
http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/trace.html Could anyone please provide me couple of examples of how to use Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.