I had been using the following script without any problems until today. I changed my linux's distro,and I don't know if it is related or not
$full = realpath($newPath."/".$image);
$data = array('name' => $name, 'pic' => '@'.$full.";type=image/jpeg");
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$contents = curl_exec($ch);
I am posting the info through a php's form, but I cannot submit the image due to that it isn't detected as an image, it is detected as "application/octet-stream"
How can I specify the content-type as an image and submit the text too?
P.D. I checked the similar questions asked before mine, I just found one with the exact purpouse and it hadn't any reply. I am not trying to download any image, I am trying to fill a form with several text fields and I should upload an image through the same form
PHP 7.0.9 (cli) (built: Jul 20 2016 17:12:28) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies, I know that I tested the script with php v5, may be that the cause of it doesn't work properly... not? @Dekel