curl_setopt() command using multipart/form-data with 2 boundary

i have to create a POST request using CURL with this parameters:

  1. The header must be: Content-Type:multipart/form-data
  2. 2 Boundary
  3. first: Content-Disposition: form-data; name="fileName" Content-Type: application/json {"fileName":[filename],"codFornitore":205900}
  4. Second: Content-Disposition: form-data; name="file"; filename="[filename]" Content-Type: [based on type of file] [byte array of file content]

How can i create a string that define this type of post body and its curl call?