-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmytest.php
More file actions
60 lines (42 loc) · 1.77 KB
/
mytest.php
File metadata and controls
60 lines (42 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
//Developed by Pinal Zala
//This test file for first time auth
include_once 'functions.php';
$token = dropbox_tokenstore::acquire_token();
if (!$token) { ?>
<a href="<?php echo dropbox_auth::build_oauth_url(); ?>">Sync your Dropbox</a>
<?php } else {
// Get Folder Content - !!! WORKING !!!
$sd = new dropbox($token);
$response = $sd->get_folder_drop(null);
// Download existing file from Dropbox to local directory
// This file is in Dropbox root directory
$remotefile = "test.txt";
foreach ($response['data'] as $item) {
$re = $sd->getimage($item['source']);
$base64 = 'data:image/' . $type[1] . ';base64,' .$re['entries'][0]['thumbnail'];
if ($item['type'] == 'folder' || $item['type'] =='album') {
// echo 'id==='.$item['id']. 'name--- > '.$item['name'];
}else{?>
Click on file name to download <a href="download.php?id=<?php echo $item['id']; ?>"><?php echo $item['name']; ?></a> </br>
<?php } }
?>
<img src="<?php echo $base64; ?>" width="50" height="50">
<?
// Create a new Folder under root directory on Dropbox
$newfolder_name = "uploadtest";
$response = $sd->create_folder_drop(null, $newfolder_name, 'Description');
// Upload local file to the new created folder (uploadtest)
// This file is in the same ftp folder with this script
$localfile = "1.jpg"; ?>
</br>
<a href="upload.php?folder_id=id:m76k86xUcmwAAAAAAAAXLg">Click here to upload</a>
<p><?php $quota = $sd->get_quota();
$allocated = $quota->allocation->allocated;
$used = $quota->used; ?>
<span>Allocated : <?php echo $allocated; ?> bytes</span></br>
<span>Used : <?php echo $used; ?> bytes</span></br>
<span>Remaining : <?php echo $allocated - $used; ?> bytes</span>
</p>
<?php }
?>