cURL file uploads not working anymore after upgrade from PHP 5.5 to 5.6

前端 未结 3 1880
礼貌的吻别
礼貌的吻别 2020-12-02 15:58

I\'ve got a cURL upload that fails after upgrading from PHP 5.5 to 5.6:

$aPost = array(
    \'file\' => \"@\".$localFile,
    \'default_file\' => \'htm         


        
3条回答
  •  天命终不由人
    2020-12-02 16:44

    Just do following changes for PHP 5.5 or greater

    Instead of "@" . $localFile just use new CurlFile($localFile)

    And set

    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
    

提交回复
热议问题