This is the past question Google이있는 동안 발견했습니다. 첫 번째 대답은 매우 간단하고 이해할 수 없습니다. 전체 스크립트는 여기curl과 함께 php를 사용하여 파일을 업로드하는이 링크의 '대상 스크립트'는 무엇입니까?
는
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/your-destination-script.php");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setpopt($ch, CURLOPT_POSTFIELDS, array(
'file' => '@/..../file.jpg', // you'll have to change the name, here, I suppose
// some other fields ?
));
$result = curl_exec($ch);
curl_close($ch);
이 내가 이해하지 못하는 것입니다,
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/your-destination-script.php");
이 대상 URL을 정의 할 수있는 장소입니다. 하지만 여기서 파일을 업로드하려면 여기에 무엇을 써야합니까?
curl_setpopt($ch, CURLOPT_POSTFIELDS, array(
'file' => '@/..../file.jpg', // you'll have to change the name, here, I suppose
// some other fields ?
));
제게 설명하거나 시도해주십시오. PHP를 처음 사용합니다.
파일에 연결하는 데 사용되는 스크립트입니다 '=>'@/.../file.jpg '파일의 경로입니다 업로드해야합니다 – Shin
예. 그러나 destination_script.php에 무엇을 써야합니까? – JaiSat