Here is the code:
$file= \'bbbb.jpg\';
$data = array(
basename($file) => \"@\".realpath($file),
\"caption\" => \"Uploaded using
Here are some various ways to upload photos using the Graph API. The examples assume you've instantiated the $facebook object and have a valid session for the current user.
This example will upload the photo to your default application album of the current user. If the album does not yet exist it will be created.
$args = array('message' => 'Photo Caption');
$args['image'] = '@' . realpath($FILE_PATH);
$data = $facebook->api('/me/photos', 'post', $args);
print_r($data);
This example will upload the photo to a specific album.
$args = array('message' => 'Photo Caption');
$args['image'] = '@' . realpath($FILE_PATH);
$data = $facebook->api('/'. $ALBUM_ID . '/photos', 'post', $args);
print_r($data);
This example will upload a photo to a specific album which requires an access token.
$args = array('message' => 'Photo Caption');
$args['image'] = '@' . realpath($FILE_PATH);
$data = $facebook->api('/'. $ALBUM_ID . '/photos?access_token='. $ACCESS_TOKEN, 'post', $args);
print_r($data);