1
votes
$facebook->setFileUploadSupport(true);


//Create an album
$album_details = array(
        'message'=> 'How will you die?',
        'name'=> 'How will you die?'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);

//Get album ID of the album you've just created
$album_uid = $create_album['id'];

//Upload a photo to album of ID...

$file='img/'.$fbid.'.jpg'; //Example image file

$photo_details = array( 'message'=> 'Find...51', 'image' => '@'.realpath($file));
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);

$upphoto = $upload_photo['id'];
print_r ($upphoto);


ImageDestroy( $canvas );

header("Location: http://www.facebook.com/" . urlencode($fbid) . "&photoid=" . urlencode($upload_photo['id'])); 

I am using this code to create a album and upload a photo in users profile on facebook with the help of facebook app. But again and aain , repeatedly i am getting three (3) errors

  1. Warning: imagejpeg() [function.imagejpeg]: Unable to open 'img/100001326588945.jpg' for writing: No such file or directory in /home/a2424901/public_html/index.php on line 58

  2. curl_setopt_array() [function.curl-setopt-array]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a2424901/public_html/base_facebook.php on line 802

  3. Fatal error: Uncaught CurlException: 3: No URL set! thrown in /home/a2424901/public_html/base_facebook.php on line 814.

Here is the base_facebook.php code

Thank you !

1
How can we help? You're missing the part of code that is causing errors. - Brad
not only that, the error messages are pretty straight forward.. What can be more simple than: the file is not there? - Nitzan Tomer

1 Answers

0
votes

try to put the relative path instead of putting the absolute path, at least that's how I resolve that problem.