FB API PHP curl_setopt_array(): The usage of the @filename API for file uploading is deprecated

后端 未结 1 1073
耶瑟儿~
耶瑟儿~ 2021-01-24 23:12

Have a problem with FB PHP API and php 5.5 with uploading photo to server. When using method :

 private function _upload( $type = \'\', $path = \'\', $message =          


        
相关标签:
1条回答
  • 2021-01-24 23:25

    You're using PHP 5.5 with the old way of uploading over CURL. Check out the differences at https://wiki.php.net/rfc/curl-file-upload

    Old

    curl_setopt($curl_handle, CURLOPT_POST, 1);
    $args['file'] = '@filename.png';
    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $args);
    

    New

    curl_setopt($curl_handle, CURLOPT_POST, 1);
    $args['file'] = new CurlFile('filename.png', 'image/png');
    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $args);
    
    0 讨论(0)
提交回复
热议问题