Hi,
Im trying to send two files vie Curl but I always get the response:
string(97) “{“StatusId”:-1,“Success”:false,“ReturnObject”:null,“Message”:“You must upload at least one file”}”
From the API.
Can you tell me if my code looks good and what the reason could be as to why the API keeps returning this message? In the next block of code I attach the documents to an email and that works fine so why does the cURL post think there are no files being sent?
> // initialise the curl request
$post = array( 'ClientId' => $client, 'Document1'=> '@'.WWW_ROOT.'img/uploads/documents/'.$newfilename.';type=application/pdf', 'Document2'=> '@'.WWW_ROOT.'img/uploads/documents/'.$newfilename2.';type=application/pdf'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://app.gcen.co.uk/Api/UploadIdDocuments”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(“Authentication: XXXX:XXXXXXXXXXXXXXXXXXXXXXXX”));
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);$json = json_decode($result);