Php 将文件上载到远程服务器时出错(Windows,cURL)

Php 将文件上载到远程服务器时出错(Windows,cURL),php,windows,file,curl,upload,Php,Windows,File,Curl,Upload,当我使用linux时,这个脚本可以工作。但如果我使用Windows,则脚本不起作用。脚本: $url="http://site.com/upload.php"; $post=array('image'=>'@'.getcwd().'\\images\\image.jpg'); $this->ch=curl_init(); curl_setopt($this->ch, CURLOPT_URL, $url); curl_setopt($this->ch, CURLOPT_RE

当我使用linux时,这个脚本可以工作。但如果我使用Windows,则脚本不起作用。脚本:

$url="http://site.com/upload.php";
$post=array('image'=>'@'.getcwd().'\\images\\image.jpg');
$this->ch=curl_init();
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 30);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post);
$body = curl_exec($this->ch);
echo $body;
日志中的错误:

*创建formpost数据失败


文件存在且可读。

执行以下操作时打印出的内容:

echo $post['image'];
它是否打印出正确的文件路径? 您是以CLI或Apache安装方式在Windows上运行此操作? 您可能必须使用:

$post['image'] = '@'.dirname(__FILE__).'\\images\\image.jpg';
这不是答案(也不是可能的解决方案),但在提到路径名时,我会将其作为旁白。(或者至少,坚持使用前斜杠(
/
),因为windows是无关紧要的,但是*nix介意)