I am trying to upload a picture using php cURL. But something is wrong about it.
This is the post data
-----------------------------192153227918513
Content-Disposition: form-data; name="resimbaslik"
CCClient
-----------------------------192153227918513
Content-Disposition: form-data; name="imgfile"; filename="clinteastwoodo.jpg"
Content-Type: image/jpeg
And I am trying to upload my picture with this php code
$postfields = array();
$postfields ["resimbaslik"] = "CCClient";
$postfields ["imgfile"] = "filename=\"clinteastwoodo.jpg\"";
$referer = "http://www.example.com/ex1.php";
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/example.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_REFERER, $referer);
$result = curl_exec ($ch);
And it is giving me 417 - Expectation Failed error.
The picture is in the same directory with my .php file.
Can someone help me to fix it?
Thank you.