无法用Curl上传文件(OSX到Windows Server)


Cannot Upload File with Curl PHP (OSX to Windows Server)

我这里有一些问题,

我有代码,有功能上传图像,以删除服务器使用CURL PHP。但我有个问题。1. 我不能用curl从我的OSX MAMP发送文件到XAMPP Windows,或者XAMPP Windows到OSX MAMP。

这是我的代码片段

    $path = 'uploads/';
    $ext = pathinfo($path.$imagesName, PATHINFO_EXTENSION);
    $ch = curl_init();
    $cfile = new CURLFile($path.$imagesName,$ext,$imagesName);
    $data = array("image" => $cfile);
    $url = $this->ocDomain . '/index.php?route=api/custom/uploadImage';
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    Log::info('Curl Image URL : ' . $url);
    $response = curl_exec($ch);

有人知道这是怎么发生的,为什么会发生吗?

请给我一个提示

if($errno = curl_errno($ch)) {
    $error_message = curl_strerror($errno);
    echo "cURL error ({$errno}):'n {$error_message}";
}

添加这个来查看是否有错误