Unexpected/invalid field in request

i have this error in php 

400 {"description":"Validation failed","errors":[{"field":"attachments[]","message":"Unexpected/invalid field in request","code":"invalid_field"}]}


this is my code

$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);

$mimetype = "";

if (isset($types[$ext])) {

        $mimetype = $types[$ext];

    } else {

        $mimetype = "Desconocida";

    }

$filename = $_FILES['file']['name'];

$filedata = $_FILES['file']['tmp_name'];

$filesize = $_FILES['file']['size'];


$ticket_payload = json_encode(array(

  "description" => $descripcion,

  "subject" => $asunto,

  "email" => $correo,

  "priority" => intval($prioridad),

  "status" => intval($estado),

  "cc_emails" => array("ram@freshdesk.com", "diana@freshdesk.com"),

  "custom_fields" => $custom_fields,

  "attachments[]" => curl_file_create($filename, $mimetype, $filedata),

));



1 person has this question
Login or Signup to post a comment