4

I have very basic and quick question. I am using PHP Dropbox API class written by Ben Tadiar. I use $object->metaData("/"); to get file list from dropbox. The data return does not include URL to download/preview of the file. So I have to call $object->media() method for each file to get the URL which results in lot of delay specially when file list is too long.

Is there anyway to get the download link along with filelist ???

2 Answers 2

2

Since I could not find any way to get download URL along with file list. The work around would be to list all the files without calling $object->media() on each item. Instead, call this method to the file that user selected to download. A simple quick function would be something like this:

function getDBDownloadUrl($Path){
    try{
        $mdb = new MyDropbox();
        $download = $mdb->media($Path);
        $download = $download['body'];
        return $download->url;
    }

    catch(Dropbox\Exception $e){
        return array("error"=>1, "message"=>"There was a problem accessing file download URL from dropbox");
    }

}
0

When calling /metadata are you calling it with 'list' set to true? If so, can't you get the path from the contents array for the file you want and GET /files with that path? https://www.dropbox.com/developers/reference/api#metadata

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.