I get the following error:
Fatal error: Uncaught CurlException: 26: failed creating formpost data thrown in /home/u801961841/public_html/inc/lib/base_facebook.php on line 814
This is the code I used:
if ($result === false) {
$e = new FacebookApiException(array(
'error_code' => curl_errno($ch),
'error' => array(
'message' => curl_error($ch),
'type' => 'CurlException',
),
));
curl_close($ch);
throw $e;
}
curl_close($ch);
return $result;
}
Does anyone know how to solve this problem?
The path to the image is not correct.
Correct it and the problem will be solved.
I presume that you are trying a file upload to Facebook, such as a photo upload. Something that involves reading a file and building into the call.
If not, then amend the question. (Your link for the source doesn't work for me - so put the relevent bits in the question.)
If so, then this error is because PHP cannot read the file that you are trying to upload. Check the file exists, check your permissions for the file, and that PHP/Apache user has rights to read it. You can do this with file_exists() and is_readable() before you build the facebook call.
If you are uploading the file using $_FILE, You need to use the "realpath($_FILE)". But if you are using local image file from your server, you need to use the dirname() to correctly point to the image.
dirname(dirname(dirname(FILE))).'/plugins/fun/images/'.$image_name;