Take the 2-minute tour ×

ISSUE:If i am using graph URL method as in facebook developer's blog here LINK,i am just able to post to a single page at a time(i want to be able to post pictures to all the selected pages of my application user).[developing an application to let users post to multiple pages at a time].So i am not using that method,and below is my method.

Using Heroku app engine,it doesn't allow to permanently store uploaded files on its server.so i can't save photos.i.e please don't refer move_uploaded_file().

Here's the code for html form field:

<form enctype="multipart/form-data" action="poster.php" method="POST">
<p>Please choose a photo: </p>
<input name="source" type="file">
<p>Add Description </p>
<input name="message" type="text" value=""> 

Here's the poster.php code:

require "facebook.php" ;
$facebook = new Facebook(array(
'appId'  => '',
'secret' => '',
'cookie' =>true,
$facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);
$parameters = array('message' => $_POST['message'],'source' =>'@' . $x );
$parameters['access_token'] = $_SESSION['active']['access_token'];
echo "<script>top.window.location='".$redirecting."';</script>";
share|improve this question

3 Answers 3

up vote 2 down vote accepted

Sorry answering my own question,but it will be really helpful a lot to all others....first of all..i am happy i did it!!!

Here is wat the mistake was... Replace $facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);



share|improve this answer
I'm glad it worked. –  Sahil Mittal Jan 8 '13 at 10:32
@Sahil finally!! –  World Gamer Jan 8 '13 at 10:35

Yes this should work because the full path will build a link of the image.

share|improve this answer
yes bro...atlast i made it!! –  World Gamer Jan 8 '13 at 10:49

I am not sure, but you may try this -

$parameters = array(
     'picture' => '@' . $path,
     'link' => $_POST['link'],
     'caption' => $_POST['caption'],
     'description' => $_POST['description']

If this doesn't solve your problem, you can share the code of API calling.

share|improve this answer
ok i am just trying it.having a lil confusion,$path = $_FILES["file"]["tmp_name"]; gives the path name along with file name or just the file name?? –  World Gamer Jan 5 '13 at 14:57
don't use this, give actual path to the file and then use the code I mentioned in comment –  Sahil Mittal Jan 5 '13 at 15:05
Can you search SO for that. –  Sahil Mittal Jan 5 '13 at 15:22

Your Answer


