Hi I am using php curl request to upload file to the box, I have tried many different package and methods but every time I am getting same error on file upload. Request response details is as below -
string(324) "{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"parent","message":"Invalid value 'd_154533439669'. 'parent' with value 'd_154533439669' not found"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Not Found","request_id":"b474svgylf4y35hk"}"
Here is my code for the request -
$curl = curl_init();
$url = 'https://upload.box.com/api/2.0/files/content';
curl_setopt($curl,CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$access_token,
'Content-Type: multipart/form-data'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, array('attributes' => '{"name": "'.$this->fileName.'", "parent": {"id": "'.$this->folderId.'"}}','file'=> new CURLFILE((string) $fileFullpath, 'text/csv', $this->fileName)) );
$response = curl_exec($curl);
curl_close($curl);
echo '<pre>';
var_dump($response);
Let me know if I am missing anything or doing anything wrong.