简体   繁体   中英

how can i access the folders in Dropbox php

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);

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

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

它将所有文件返回到hello文件夹(返回数组)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM