CRM API (PHP) - File Upload Field

CRM API (PHP) - File Upload Field

Hi,

I'm using the API to create a record, then upload a file to 'https://www.zohoapis.eu/crm/v2/files', which is succeffully returning a File ID.

The issue I'm having is then getting this file to show in a file field in Zoho.

This post (https://help.zoho.com/portal/en/community/topic/want-to-upload-images-to-custom-image-fields-using-zoho-crm-api-v2?src=zcomforumjul19) states to insert the data in the below format, which I'm assuming should be an array?

"File_Upload_1":["hsdhdsud97d9uod8d8d08d0uddu09d80dodud0dd9ddd"]

I'm assuming 'File_Upload_1' is the field name? In my case this is 'Proof_of_Income'. However nothing I've tried is working, this is what I've got currently:


  1.                 $proof_of_income = $data["data"][0]['details']['id'];

                    $data = json_decode($token, true);

                    $apiUrl = "https://www.zohoapis.eu/crm/v2/Potentials/" . $loan_application_ID;

                    $fields = json_encode(array("data" => array(["Proof_of_Income" => array($proof_of_income)])));

                    $headers = array(
                        'Content-Type: application/json',
                        sprintf('Authorization: Zoho-oauthtoken %s', $access_token)
                    );

                    $ch = curl_init();

                    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
                    curl_setopt($ch, CURLOPT_URL, $apiUrl);
                    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
                    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

                    $output = curl_exec($ch);

                    $data = json_decode($output, true);

                    var_dump($data);

                    curl_close($ch);
I'm getting a response that the record has been updated succesfully, but the field is still blank in Zoho.

Any help would be appreciated