Jump to content

Using Dropbox API in php, how to show files in user interface


nshthmistry

Recommended Posts

I have used Dropbox API in my website. I have completed Oauth and I'm successfully getting metadata. now i'm clueless..

MetaData:

Metadata content for /

 

Array

(

[hash] => 

[thumb_exists] => 

[bytes] => 0

[path] => /

[is_dir] => 1

=> 0 bytes

[root] => app_folder

[contents] => Array

(

[0] => Array

(

[revision] => 20

[rev] => 

[thumb_exists] => 1

[bytes] => 6974

[modified] => Fri, 28 Feb 2014 11:02:10 +0000

[client_mtime] => Fri, 28 Feb 2014 11:02:10 +0000

[path] => /skhan.jpg

[is_dir] => 

[icon] => page_white_picture

[root] => dropbox

[mime_type] => image/jpeg

=> 6.8 KB

)

 

 

How can i use this metadata to show files to users?

 

please help

The metadata is an array. To get the information out of the array you need to loop through it. Example code to display files in a table

echo '<p>There are ' . count($metadata['contents']) . ' files in ' . $metadata['path'] . ':</p>
<table border=1 cellpadding=10>
  <tr>
   <th>Name</th>
   <th>Siize</th>
  </tr>';
foreach($metadata['contents'] as $file)
{
    echo '<tr>
   <td>' . $file['path'] . '</td>
   <td>' . $file['size'] . '</td>
  </tr>';
}
echo '</table>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.