Question

i am trying to read and write a folder in Dropbox. so i have registered my app in DropBox ..

Details of my App is..

Permission type App folder

App folder name hello

now the "hello "folder is in this directory at the moment

https://www.dropbox.com/home/Apps/

so when i do this

  $files = $this->DropboxApi->ls( );
        pr($files);

the result i am getting is this

Array
(
    [Dropbox] => Array
        (
            [hash] => *****************
            [thumb_exists] => 
            [bytes] => 0
            [path] => /
            [is_dir] => 1
            [size] => 0 bytes
            [root] => app_folder
            [contents] => Array
                (
                )

            [icon] => folder
        )

)

so the problem is i dont know how can i access the folder hello

what should be the path

$files = $this->DropboxApi->ls('Path);
Was it helpful?

Solution

Let's suppose you want to write file name myfile.extension in folder myfolder then your upload path will be:

<root>/myfolder/myfile.extension

then your endpoint url to upload file will be:

https://api-content.dropbox.com/1/files_put/dropbox/myfolder/myfile.extension

In case of download you first need to send request to endpoint:

https://api.dropbox.com/1/media/dropbox/myfolder/myfile.extension

In response you will get json like: {"url":"here is downloadable link"}

To see contents/details in folder, endpoint will be:

https://api.dropbox.com/1/metadata/dropbox/hello?list=true

OTHER TIPS

$folder = $dropbox->GetFiles("hello",false);

it return all the files into the hello folder(return array)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top