How to send a file along with a statement email with cURL and Zoho Books API ?

How to send a file along with a statement email with cURL and Zoho Books API ?

I'm trying to add a PDF file to a POST request to the API via PHP and cURL. But I cannot find the right way to add it.

Every time, I get this error message :

Invalid value passed for multipart_or_formdata

Here is an example PHP code :
  1. $file_path = '/location/to/file.pdf';
    $file = new CurlFile($file_path, 'application/pdf', 'file');

    $data = new stdClass;
    $data->multipart_or_formdata = $file;
    $post_data = array(
        'JSONString'        => json_encode($data),
    );

    // POST /contacts/{:contact_id}/statements/email
    $header = array('Content-Type: multipart/form-data');
    $curl = curl_init($request_url);
    $opt_array = array();
    $opt_array[CURLOPT_RETURNTRANSFER] = true;
    $opt_array[CURLOPT_POST] = 1;
    $opt_array[CURLOPT_HTTPHEADER] = $header;
    $opt_array[CURLOPT_POSTFIELDS] = $post_data;
       
    curl_setopt_array($curl, $opt_array);
    $request_result = curl_exec($curl);
Any precision on how to add a file in this context in a PHP script ?