Uploading Files

Hi all,

Hoping you can help, have a very simple piece of code and can’t for the life of me figure out why it doesn’t work. I’ll link the code and then the error! Seems like the key for “file” isn’t recognised for whatever reason?

$PIPEDRIVE = array(
‘file’=>$DLFILE,
‘deal_id’=>154
);
$curl = curl_init($URL);
$Headers = [
‘Content-Type: multipart/form-data’,
‘Cache-Control: no-cache’
];
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $Headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $PIPEDRIVE);

echo ‘Sending request…’ . PHP_EOL;

$output = curl_exec($curl);
curl_close($curl);

echo $output;

JSON Response

“error”: “Invalid input: file - This field was not expected.”,

Hi,
You might find the following wiki useful

Feel free to create a new topic if you still face challenges.