Search files and folders in dropbox API

1.2k Views Asked by At

I am developing a application that will show all the files and folders in the web page. I have done this.

Now i am trying to add search filter for that.
I have searched in google. But not getting expected result.

I have completed getting the accessToken from credential.

$client = new Dropbox\Client($_SESSION['accessToken'],parent::$appName,'UTF-8');

From this I am getting all the files.
How to pass the search file names or folder names here?

1

There are 1 best solutions below

2
lalithkumar On BEST ANSWER

You can not pass the file names or folder names in the Dropbox\Client.
There is separate function(searchFileNames) to pass the path,query string.

If you pass the parameter that will return the files and folder.

$client = new Dropbox\Client($_SESSION['accessToken'],parent::$appName,'UTF-8');

$foldername=isset($foldername)?$foldername:'';
$dropbox_file=$client->searchFileNames('/'.$foldername,$search);

if you print the $dropbox_file you can see the files and folders.

echo '<pre>';
print_r($dropbox_file);
echo '</pre>';

For more functions you can check here