I looked at several stackoverflow messages about this error message, but none of them worked for me.
I want to upload a photo to facebook:
public function uploadPhoto($path){
$photoSettings = array(
'access_token'=> $this->facebook->getAccessToken(),
'name' => 'uploaded foto',
'source' => '@' . realpath($path)
);
$photo = $this->facebook->api('me/photos','POST',$photoSettings);
}
When I call this function, I get the following error message:
Uncaught CurlException: 26: failed to create formpost data
I am 100% sure that the image I want to upload exists (and the path is correct).
This is my facebook initialization: (fileUpload is true)
$this->facebook = new Facebook(array(
'appId' => $this->config['appId'],
'secret' => $this->config['appSecret'],
'fileUpload' => true,
'cookie' => true
));
I really don't understand why I am getting this error because my code seems to be correct. Do you think there may be a problem with the cURL server / server configuration? I do not know much about cURL.
I hope you help me! I look forward to your answers :-)
Hello Andreas