I need to create an array of the directory contents in Dropbox 开发者_StackOverflow中文版with PHP and save it in a variable. Any thoughts?
Edit: With this I mean from a web server, not locally.
You'll want to be using the Dropbox API, there's a PHP library for it.
Specifically, you'll need the getMetaData function.
$files_in_directory = $DropboxObject->getMetaData ("directory/you/want", true);
This should help
function getDirOptions($path) {
$back = "";
if ($handle = opendir($path)) {
while (false !== ($res = readdir($handle))) {
$options.="<OPTION VALUE='$res'>$res</OPTION>";
}
closedir($handle);
}
$back = "<SELECT NAME='dir'>$options</SELECT>";
return $back;
}
精彩评论