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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:18:29+00:00 2026-06-06T16:18:29+00:00

I am trying to post an image to a Facebook album using a form

  • 0

I am trying to post an image to a Facebook album using a form in my website. I know I get the correct access token because posting without jQuery and AJAX works fine – but redirects me out of my website. To solve that, I’ve made a jQuery AJAX post, but this gives me an error I don’t understand.

I’m using:

<script type="text/javascript" src="../Components/JQUERY/jquery-1.4.2.min.js"></script>    
<script type="text/javascript" src="../Components/JQUERY/jquery.validate.min.js"></script>

The code is:

  1. Getting the access token and preparing the URL to post to (It is OK, posting without jQuery is uploading the picture to Facebook):

    //....Facebook code for getting the access token...//
    
    // This is the URL that was originally in the form's action tag//
    $image_url= "https://graph.facebook.com/" . $ALBUM_ID . "/photos?"
    . "access_token=" .$access_token;
    
  2. HTML of the form:

    <form name="myform" id="myform" enctype="multipart/form-data" action="" method="POST">
       Please choose a photo:
         <input name="source" type="file"><br/>
       Say something about this photo: <br/>
         <textarea id="fbText" name="message" rows="4" cols="47"> </textarea><br/><br/>
         <input type="submit" name="submit" value="Upload"/><br/>
    </form>
    
    <div id="results"></div>
    
  3. The jQuery Code:

    <script type="text/javascript">
      $(document).ready(function(){
          $("#myform").validate({
              debug: false,
              rules: {
                  message: "required"   
              },
              messages: {
                  message: "Please insert text."
              },
              submitHandler: function(form) {
                  // do other stuff for a valid form
                  $.post('<?php echo $image_url ?>', $("#myform").serialize(), function(data) {
                    $('#results').html(data);
                });
            }
        });
    });
    </script>
    

Pressing the upload button gives me the following error:

enter image description here

What am I doing wrong?
Thanks.

  • 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-06T16:18:30+00:00Added an answer on June 6, 2026 at 4:18 pm

    You cannot post a multipart form data with jquery post method. And one more issue is, cross domain communication. You cannot send ajax request to another domain.

    For alternatives, see

    How do you post to an iframe?
    http://jquery.malsup.com/form/#file-upload

    Facebook new javascript sdk- uploading photos with it!

    For sending multipart data through ajax see these links

    Making an HTTP POST call with multipart/form-data using jQuery?

    Sending multipart/formdata with jQuery.ajax

    or Lastly, you can upload to your server and upload to facebook..

    [EDIT]

    var options = { 
            beforeSubmit:  showRequest,  // pre-submit callback 
            success:       showResponse  // post-submit callback      
        }; 
    
        // bind form using 'ajaxForm' 
        $('#myForm1').ajaxForm(options); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to post an image to an album on facebook and place
i'm trying to post an image to my users's facebook wall once they hit
I am trying to POST an image to imageshack using their API and Play
Hello I am trying to get profile image of facebook user in Table's cell.image.
I am trying to submit a form via ajax using: $(document).ready(function(){ $(#ajax-form).submit(function(){ $.post( albums.php,
I am trying to post image on facebook but not successful yet, my codes
I'm trying to post a Facebook status update, using the Facebook iOS API, with
I'm trying to post an image to TwitPic.com using their API. However, I have
I'm trying to upload a picture to a Facebook album using the Graph API.
I am trying to post messages to facebook wall using Android's default Facebook client.

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.