I am trying to upload file using the code below
$response = $client->request('POST', 'https://upload.box.com/api/2.0/files/content', [
'headers' => [
'Authorization' => "Bearer {$access_token}",
'Content-Type' => 'application/x-www-form-urlencoded'
],
'attributes' => [
'name' => $file,
'parent' => ['id',$parent_id],
'file' => $filePath
]
]);
After I run the code on browser, I get this below error
Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: POST https://upload.box.com/api/2.0/files/content resulted in a 415 Unsupported Media Type
Any better approach to upload file using GuzzleHttp?.