[ACCEPTED]-How to use PHP cURL to send images with the correct Content-Type?-curl

Accepted answer
Score: 18

Use the CURLOPT_HTTPHEADER option:

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: image/jpeg"));

So specify 2 Content-Type headers specifically for file 1 uploads, use:

$params = array('name'=>'@D:\globe.jpg;type=image/jpeg');
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

More Related questions