Source

Ten Sports Stationary / post.php

Full commit
<?php
require 'scripts/facebook.php';
require 'session.php';
$your_base64_string=$_SESSION['image_data'];
	session_start();
	if (isset($_SESSION['image_data'])) {
		echo $_SESSION['image_data'];
	}
	else {
		'no session data';
	}

function base64_to_jpeg( $base64_string, $output_file ) {
  if(file_exists($output_file)) unlink($output_file);
  $ifp = fopen( $output_file, "wb" ); 
  fwrite( $ifp, base64_decode( $base64_string) ); 
  fclose( $ifp ); 
  return( $output_file ); 
}
$facebook = new Facebook(array(
  'appId'  => '382132615191193',
  'secret' => 'ce402aee16df3ff392656f4fd6678a53',

));
$facebook->setFileUploadSupport(true);
$image = base64_to_jpeg( $your_base64_string, 'tmp.png' );
$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken());
echo $args['access_token'];
echo realpath($image);
$args['image'] = '@' . realpath( $image );
$data = $facebook->api('/me/photos', 'post', $args);
unlink($image);
?>