Fatal error: Uncaught CurlException: 26: failed creating formpost data thrown

独自空忆成欢 提交于 2019-12-12 17:48:57

问题


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?


回答1:


The path to the image is not correct. Correct it and the problem will be solved.




回答2:


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.




回答3:


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;



来源:https://stackoverflow.com/questions/11062427/fatal-error-uncaught-curlexception-26-failed-creating-formpost-data-thrown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!