Unexpected/invalid field in request

  • 18 May 2018
  • 0 replies
  • 723 views

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),

));




This topic has been closed for comments