2011-02-01 3 views
1

linux를 사용할 때이 스크립트가 작동합니다. 그러나 Windows를 사용하면 스크립트가 작동하지 않습니다. 스크립트 : 로그에원격 서버 (Windows, cURL)에 파일 업로드시 오류

$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']; 

가 올바른 파일 경로를 인쇄합니까 : 당신이 할 때

+1

되지 않음 대답 (도 가능성이 용액)하지만 제쳐두고 내가 [DIRECTORY_SEPARATOR] (http://php.net/manual/en/dir.constants 사용할 수 있습니다. php)를 참조하십시오. (또는 최소한 창은 무관심한 것처럼 슬래시 ('/')를 사용하여 붙잡아 라. * nix minds) –

답변

0

은 무엇을 인쇄? Windows에서이 유틸리티를 CLI 또는 Apache 설치로 실행하고 있습니까? 당신은 사용해야 할 수도 있습니다 :

$post['image'] = '@'.dirname(__FILE__).'\\images\\image.jpg'; 
관련 문제