How To Upload Photo to Facebook ? (Uncaught OAuthException: (#324) Requires upload file thrown )

2,192 views
Skip to first unread message

the.rev...@gmail.com

unread,
May 5, 2012, 1:40:54 PM5/5/12
to hybri...@googlegroups.com
I follow this  http://stackoverflow.com/questions/4509326/upload-images-to-a-specific-facebook-album/4541400#4541400 and customize the code to meet the Hybridauth standard. Below is my code 
$post_data = array(
    'name' => "My Test Album",
    'description' => "My Test Album Desc"
);
$data['album'] = $facebook->api()->api("/me/albums", 'post', $post_data);

$post_data = array(
    "message" => "My photo caption",
    "source" => '@' . realpath($file)
);
$album_id = $data['album']['id'];
$data['photo'] = $facebook->api()->api("/$album_id/photos", 'post', $post_data);

var_dump($data);

The album is successfully created, but the photo failed to be uploaded. And always show error like below:
Uncaught OAuthException: (#324) Requires upload file thrown 

Could you tell me what's wrong with my code ? Thanks :-)

the.rev...@gmail.com

unread,
May 8, 2012, 2:04:28 PM5/8/12
to hybri...@googlegroups.com
Good evening everybody,

any idea ? :-)

Miled

unread,
May 10, 2012, 4:42:17 PM5/10/12
to hybri...@googlegroups.com
you should enable file upload first :
$facebook->api()->setFileUploadSupport(true); 

also, I believe the image should exist on your server, so it wont work with urls

the.rev...@gmail.com

unread,
May 11, 2012, 9:43:53 PM5/11/12
to hybri...@googlegroups.com
I've tried that, but Uncaught CurlException: 26: failed creating formpost data thrown  is raised
Reply all
Reply to author
Forward
0 new messages