I am trying to upload files with php using the dropbox-sdk-php library
This is the code I am using
$dropboxKey ='MY_KEY';
$dropboxSecret ='MY_SECRET';
$appName='MY_APPNAME';
$acessToken = "MY_ACCESTOKEN";
$appInfo = new Dropbox\AppInfo($dropboxKey,$dropboxSecret);
//Store CSRF token
$csrfTokenStore = new Dropbox\ArrayEntryStore($_SESSION['k6'],'dropbox-auth');
//define auth details
$webAuth = new Dropbox\WebAuth($appInfo,$appName,'http://localhost',$csrfTokenStore);
$client = new Dropbox\client($acessToken,$appName,'UTF-8');
//time to upload file
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$ext = explode(".", $_FILES['file']['name']);
$ext =end($ext);
$fullname = "/". $nombre .'.'.$ext;
$size = explode(".", $_FILES['file']['size']);
try{
$client->uploadFile($fullname,Dropbox\WriteMode::add(),$tempFile,$size);
}catch(Dropbox\Exception_InvalidAccessToken $e){
Echo "Error";
}
}
It doesn't show me any error but the post returns me status code: 500
I have solved the problem with the help of stackiverflow in English I leave the link to the post
here
The request was to change the SDK since the Dropbox api was not compatible with the library