I use below code to post a photo on wall usually
$attachments = array(
'message' => $mess,
'access_token' => $access_token
);
$facebook->setFileUploadSupport(true);
$attachments['image'] ='@'.realpath($filename);
$photoz = $facebook->api('/'.$aid.'/photos', 'POST', $attachments);
I use Google app engine, so above wont work, so i followed below method
$filename ="prof.jpg";
$im ='@'.realpath($filename);
$post = "https://graph.facebook.com/".$aid."/photos?access_token=".$access_token."&message=hellohi&source=".$im."&method=POST";
$upload = fetch_url($post);
echo $upload;
But when i get the error #324) Requires upload file","type":"OAuthException","code":32
Can i know what is the reason?and where am i wrong?
ps - $im returns @/base/data/home/apps/s~myphotoapp/1.362007154292719350/prof.jpg
But when i get the error #324) Requires upload file","type":"OAuthException","code":32
Can i know what is the reason?
Simple: You did not actually upload a file as an HTTP upload.
The data has to be encoded in a format known as multipart/form-data
– whereas you are just putting the parameters into an URL, which is something different.
So either you go and do some research, how to send data as multipart/form-data
within the scope of techniques Google App Engine offers you;
or … if your images publicly are accessible via HTTP, you can also switch the source
parameter for a parameter called url
, in which you give the HTTP URL under which the image is retrievable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.