Jump to content

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


Go to solution Solved by Ch0cu3r,

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

  • Solution

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>';
Edited by Ch0cu3r
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.