I am using below code to upload pic to an item row but gets blank response, no error
Please help
$filepath = “dec-logo201901.png”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://api.monday.com/v2/file’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$post = array(
‘query’ => “mutation {
add_file_to_column (item_id: 6441733054, column_id: ‘files’, file: ‘$filepath’) {
id
}
}”,
‘variables’ => ‘"{"item_id": 6441733054, "column_id": "files"}"’,
‘map’ => ‘"{"image":"variables.file"}"’,
‘file’ => ‘@’ .realpath(“$filepath”)
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$headers = array();
$headers = ‘Api-Version: 2024-01’;
$headers = 'Authorization: '.$token;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
echo $result = curl_exec($ch);
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);
}
curl_close($ch);