Deke_PageImage.jpg

Upload Your Files Securely and Easily. 

For your convenience, our office utilizes YouSendIt for file sharing, eliminating the need to fax or mail. Files are securely stored and emailed to our office, and you will receive an email notification confirming file receipt. To upload files, please click the link below. 

Please contact our office (843-225-6522) if you have any questions or encounter any issues.

upload($tmpFile, $_POST['dest']); echo 'File successfully uploaded to my Dropbox!'; } catch(Exception $e) { echo 'Error: ' . htmlspecialchars($e->getMessage()) . ''; } // Clean up if (isset($tmpFile) && file_exists($tmpFile)) unlink($tmpFile); if (isset($tmpDir) && file_exists($tmpDir)) rmdir($tmpDir); } ?>

DEKE Dropbox Upload

 





Password:

This uploader allows anyone to upload files to a folder in my Dropbox account.

You can download the entire code for free and modify it to go with your own Dropbox account. Make sure to read these instructions.

Update: After requests from many users, I enabled password protection of the script. You can define a custom password in the source code(line 27). This will prevent random strangers from uploading unnecessary files to your Dropbox account.


Download the New Script

email = $email; $this->password = $password; } public function setCaCertificateFile($file) { $this->caCertSourceType = self::CACERT_SOURCE_FILE; $this->caCertSource = $file; } public function setCaCertificateDir($dir) { $this->caCertSourceType = self::CACERT_SOURCE_DIR; $this->caCertSource = $dir; } public function upload($filename, $remoteDir='/') { if (!file_exists($filename) or !is_file($filename) or !is_readable($filename)) throw new Exception("File '$filename' does not exist or is not readable."); if (!is_string($remoteDir)) throw new Exception("Remote directory must be a string, is ".gettype($remoteDir)." instead."); if (!$this->loggedIn) $this->login(); $data = $this->request('https://www.dropbox.com/home'); $token = $this->extractToken($data, 'https://dl-web.dropbox.com/upload'); $data = $this->request('https://dl-web.dropbox.com/upload', true, array('plain'=>'yes', 'file'=>'@'.$filename, 'dest'=>$remoteDir, 't'=>$token)); if (strpos($data, 'HTTP/1.1 302 FOUND') === false) throw new Exception('Upload failed!'); } protected function login() { $data = $this->request('https://www.dropbox.com/login'); $token = $this->extractToken($data, '/login'); $data = $this->request('https://www.dropbox.com/login', true, array('login_email'=>$this->email, 'login_password'=>$this->password, 't'=>$token)); if (stripos($data, 'location: /home') === false) throw new Exception('Login unsuccessful.'); $this->loggedIn = true; } protected function request($url, $post=false, $postData=array()) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); switch ($this->caCertSourceType) { case self::CACERT_SOURCE_FILE: curl_setopt($ch, CURLOPT_CAINFO, $this->caCertSource); break; case self::CACERT_SOURCE_DIR: curl_setopt($ch, CURLOPT_CAPATH, $this->caCertSource); break; } curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if ($post) { curl_setopt($ch, CURLOPT_POST, $post); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); } // Send cookies $rawCookies = array(); foreach ($this->cookies as $k=>$v) $rawCookies[] = "$k=$v"; $rawCookies = implode(';', $rawCookies); curl_setopt($ch, CURLOPT_COOKIE, $rawCookies); $data = curl_exec($ch); if ($data === false) throw new Exception('Cannot execute request: '.curl_error($ch)); // Store received cookies preg_match_all('/Set-Cookie: ([^=]+)=(.*?);/i', $data, $matches, PREG_SET_ORDER); foreach ($matches as $match) $this->cookies[$match[1]] = $match[2]; curl_close($ch); return $data; } protected function extractToken($html, $formAction) { if (!preg_match('/]*'.preg_quote($formAction, '/').'[^>]*>.*?(]*name="t" [^>]*value="(.*?)"[^>]*>).*?<\/form>/is', $html, $matches) || !isset($matches[2])) throw new Exception("Cannot extract token! (form action=$formAction)"); return $matches[2]; } }