<?php include plugin_dir_path(__FILE__) . 'DropboxClient.php'; $dropbox = new DropboxClient(array('app_key' => "cv3o964lig1qrga", 'app_secret' => "7g05tjesk5fgqjk", 'app_full_access' => false), 'en'); handle_dropbox_auth($dropbox); // see below // if there is no upload, show the form // store_token, load_token, delete_token are SAMPLE functions! please replace with your own! function store_token($token, $name) { file_put_contents(plugin_dir_path(__FILE__) . "tokens/{$name}.token", serialize($token)); } function load_token($name) { if (!file_exists(plugin_dir_path(__FILE__) . "tokens/{$name}.token")) { return null; } return @unserialize(@file_get_contents(plugin_dir_path(__FILE__) . "tokens/{$name}.token")); } function delete_token($name) { @unlink(plugin_dir_path(__FILE__) . "tokens/{$name}.token"); } function handle_dropbox_auth($dropbox) { // first try to load existing access token $access_token = load_token("access"); if (!empty($access_token)) { $dropbox->SetAccessToken($access_token); } elseif (!empty($_GET['auth_callback'])) { // then load our previosly created request token
} </style> </head> <?php $option = get_option('speu_dropbox_config'); if (empty($option)) { $option['app_key'] = "2yiumoyh9yz10xh"; $option['app_secret'] = "etex9mg2yqoxz51"; $option['access_token'] = "9xBz_RqYg6AAAAAAAAAA7ycedsuBw_YMUFEQz5eIw7EFoIyOw8Xz-GSVlR05haNA"; } error_reporting(E_ALL); require_once "DropboxClient.php"; // you have to create an app at https://www.dropbox.com/developers/apps and enter details below: $dropbox = new DropboxClient(array('app_key' => $option['app_key'], 'app_secret' => $option['app_secret'], 'app_full_access' => false), 'en'); handle_dropbox_auth($dropbox, $option); // see below // if there is no upload, show the form if (empty($_FILES['the_upload'])) { ?> <img src="logo.png" class="dropbox"> <form enctype="multipart/form-data" method="POST" action=""> <p> <h3 class="text-center text-before-center" style="color: #57A6EC;"> Click to upload <code>CSV</code> file to <code>Dropbox</code> </h3> <input type="file" name="the_upload[]" class="filestyle import_file" data-buttonName="btn-primary" data-placeholder="No file imported" data-badge="true" data-icon="glyphicon-inbox" value="<?php $speu_exported_file = get_option('speu_export_file'); echo 'C:/xampp/htdocs/export-results_2016-03-28 (7).csv'; ?> " multiple="multiple">