0

I have this piece of code.

$str1 = $test."\\".$actualfilename;
$str2 = $finalPath."\\".$folder."\\".$subfolder;
$source = mb_convert_encoding($str1, "UTF-8");
   echo "<br/>". $source;
 $dest = mb_convert_encoding($str2, "UTF-8");
 echo "<br/>" .$dest;
$client->move($source,$dest);

Want to move file but getting this error:

Fatal error:  Uncaught exception 'InvalidArgumentException' with message ''fromPath': bad path: must start with "/": "C:\\Dropbox\\Salesforce Documents\\Opportunities\\UR-000001\\123432.pdf.txt"' in D:\xampp\htdocs\dropboxapi\vendor\dropbox\dropbox-sdk\lib\Dropbox\Path.php:169
Greg
  • 16,359
  • 2
  • 34
  • 44
Nishant
  • 19
  • 8

1 Answers1

1

The error message indicates that the fromPath should start with "/", but yours starts with "C:\\".

When performing file operations on the Dropbox API like this, the remote file paths need to be relative paths in the Dropbox folder. That is, something like "/folder/file.txt".

You're instead passing the local file path. To fix this, use the relative paths of the files in the account instead.

Greg
  • 16,359
  • 2
  • 34
  • 44