File Upload issue Using API
Hi - I am trying to upload a file using php WEB API, please let me know what am I doing wrong in the below code.
$params = {"file":{"name":"\/home\/projsnap\/public_html\/artwork\/wp-content\/uploads\/2022\/02\/PSNAP-PoqAOGtSk6.jpeg","mime":"","postname":"PSNAP-PoqAOGtSk6.jpeg"},"name":"PSNAP-PoqAOGtSk6.jpeg","parent_id":"115643781052","access_token":"XaMcjFobU7b3egPcD7ndifBkT4RFbq5u"}
$params = array('file' => $file, 'name' => $name, 'parent_id' => $parent_id, 'access_token' => $this->access_token);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
$data = curl_exec($ch);
curl_close($ch);
return $data;
I am getting below error -
{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"parent","message":"Invalid value 'd_115643781052'. 'parent' with value 'd_115643781052' not found"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Not Found","request_id":"4rf8g4gz65g9qhey"}
-
Hello Alex Novotny
We are using the OAuth 2.0 (User or Client Authentication) app type. Also we provided folder access. Please check the screenshot. http://prntscr.com/26wt1gs -
Hello Alex Novotny
Yes all the folder has been created by the same user. and Also the user sign in the application. We are using the access token to upload the files and created a folder. Previously it was working fine. The issue comes in last 15 days.
Post is closed for comments.
Comments
4 comments