This is the past question I've found while I was google. The first answer is pretty simple and I don't understand.
The whole script is here,
$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);
This is what I don't understand,
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/your-destination-script.php");
this is the place to define destination url. But what should I write in there to upload a file from here,
curl_setpopt($ch, CURLOPT_POSTFIELDS, array(
'file' => '@/..../file.jpg', // you'll have to change the name, here, I suppose
// some other fields ?
));
Please someone explain me or please try. I'm new to PHP.