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 9002225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:32:30+00:00 2026-06-16T00:32:30+00:00

I am using the Facebook Javascript SDK to upload a photo to the user’s

  • 0

I am using the Facebook Javascript SDK to upload a photo to the user’s timeline. This is my call:

function post_photo_to_facebook() {
    var file_name = 'https://my-image.url.com/image.jpg';
    var access_token = FB.getAuthResponse()['accessToken'];
    $.ajax({
        type: "POST",
        url: "https://graph.facebook.com/me/photos",
        data: {
            message: "Here is my message",
            url: file_name,
            access_token: access_token,
            format: "json"
        },
        success: function(data){
            alert("POST SUCCESSFUL");
        },
        error: function(data){
            alert('Error');
            console.log(data);
        }
    });
}

When in Chrome, I am receiving an Error back from this AJAX call, yet the statusText is “OK”, and the image is being successfully uploaded to my timeline. I am just wondering what I am missing here – why is the error being called?

  • 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-16T00:32:30+00:00Added an answer on June 16, 2026 at 12:32 am

    You should be using FB.api to upload images, rather than ajax POST due to CORS reasons.

    So your code above would look like this:

    var file_name = 'https://my-image.url.com/image.jpg';
    
    FB.api('/me/photos', 'post', {
        message:'Here is my message',
        url:file_name        
    }, function(response){
    
        if (!response || response.error) {
            alert('Error occured');
        } else {
            alert('Post ID: ' + response.id);
        }
    
    });
    

    and you use FB.init to set up your tokens etc.

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

Sidebar

Related Questions

I'm trying to upload a photo on Facebook using Javascript SDK. In particular I
I'm in the process of using the facebook javascript sdk to provide user login
Using Javascript SDK for Facebook, you can do a FB.login(function(response) { if (response.authResponse) {
I am using facebook javascript SDK to post comment on facebook and using this
I'm using Facebook's JavaScript SDK and trying to determine if the user is logged
using Facebook Javascript SDK (since FBml doesn't work anymore), posting to a wall using
We are using Facebook JavaScript SDK to authenticate our Facebook application. The application is
I have been using the Facebook Javascript SDK to post content from a CMS
I am currently using the Facebook Javascript SDK and the Facebook C# SDK (soley
I have built a Facebook app using the Javascript SDK that has been up

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.