Comments (4)
Hey @jeffreyflukman,
I know I'm not the developer, but I saw your issue by accident and since I have created a testfile that does exactly this, I thought I might share it with you. There you go.
<?php
/**
* 1. Authenticate user.
* 2. Retrieve account information.
* 3. Retrieve file information.
*/
// Require the bootstrap
require_once('bootstrap.php');
// Retrieve the account information
$accountInfo = $dropbox->accountInfo();
$metaData = $dropbox->metaData();
// Output
?>
<html>
<head>
<title>DropboxAPI Test</title>
<style type="text/css">
.main {
width: 1000px;
margin: 0 auto;
border: 1px solid black;
}
.accountInfo {
width: 80%;
margin: 10 auto;
padding: 10px;
border-bottom: 1px solid black;
}
.welcome {
font-weight: bold;
text-align: center;
}
.fileInfo {
width: 80%;
margin: 10 auto;
padding: 10px;
border-bottom: 1px solid black;
}
.fileList {
list-style-type: none;
margin: 0;
padding: 0;
}
.fileListItem {
width: 100%;
position: relative;
padding-left: 50px;
}
.fileImage {
display: inline-block;
width: 20px;
height: 20px;
background: white url('/images/pdficon_16x16.png') no-repeat center center;
vertical-align: center;
}
.fileSize {
position: absolute;
right: 100px; /* twice padding-left to make sure left- and right space are equal */
}
.debug {
display: none;
width: 80%;
margin: 10 auto;
padding: 10px;
font-size: 80%;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -o-pre-wrap;
background: #faf8f0;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="main">
<div class="accountInfo">
<p class="welcome">Hello <?php echo($accountInfo['body']->display_name); ?>!</p>
</div>
<div class="fileInfo">
<?php if (count($metaData['body']->contents) > 0) : ?>
<p class="fileHeader">This is a list of all files in your [APP] Dropbox.</p>
<ul class="fileList">
<?php
foreach ($metaData['body']->contents as $fileObject) {
$fileName = basename($fileObject->path);
$fileSize = $fileObject->size;
$fullFileName = $fileObject->path;
echo(' <li class="fileListItem"><span class="fileImage"> </span><span class="fileName">' .
$fileName . '</span><span class="fileSize">' . $fileSize . "</span></li>\n");
}
?>
</ul>
<?php else : ?>
<p>You do not have any files in your [APP] Dropbox.</p>
<?php endif; ?>
</div>
<div class="debug">
<?php
var_dump($metaData);
?>
</div>
</div>
</body>
</html>
Oh, I originally had code to show only the PDF files, but thats not hard, just look at the 'metaData()' information. This is shown in the debug-part. If you remove the display: none;
line under .debug
in the CSS, you will see what $dropbox->metaData()
returns. Anyway, that is the reason there is a PDF-icon for every file (which you probably won't see as you do not have an images directory). Note that there is a method in the API to get a thumbnail for a file!
I know, a way too big example with way too much styling and HTML, but you will see it is quite easy actually.
from dropbox.
Hi @Caster ..!
Thx so much for your example here.. it's really helpful..
from dropbox.
Hi @jeffreyflukman,
If it solves your issue you can mark the issue as closed. If you would like to see some more examples, please ask. Also don't forget to check out the examples provided by @benthedesigner!
from dropbox.
Hi @Caster
Thanks for picking this one up and helping @jeffreyflukman resolve his issue. Much appreciated.
from dropbox.
Related Issues (20)
- Request token not found After allow OAuth. HOT 2
- files starts with symbol @ not uploading. HOT 1
- The cURL OAuth consumer requires the cURL extension HOT 2
- Problem with putStream HOT 3
- Warning: Unexpected character in input: '\' (ASCII=92) state=1 HOT 2
- Can ConsumerAbstract->getRequestToken be public? HOT 1
- Forbidden error HOT 4
- Fatal Error HOT 3
- Examples not working HOT 2
- pufile.php example not working : Invalid file extension
- How to deploy this into my own server? Error:'Couldn't resolve host 'api.dropbox.com'' HOT 3
- "This app has been disabled." HOT 3
- Installation Instructions for Acquia Drupal ??
- How to set to the userID dynamically for each user? HOT 1
- Apps/TestFolder rights question HOT 1
- Need Help with Href Link
- Connect via token (upload file to one account) HOT 2
- How to use this library without Composer? HOT 2
- Migration to API v2
- Could not resolve host: api-content.dropbox.com HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropbox.