Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. if (isset($_FILES["file"])) {
  2. // File to Upload
  3. $file = $_FILES['file'];
  4. // File Path
  5. $fileName = $file['name'];
  6. $filePath = $file['tmp_name'];
  7. try {
  8. // Create Dropbox File from Path
  9. $dropboxFile = new DropboxFile($filePath);
  10. // Upload the file to Dropbox
  11. $uploadedFile = $dropbox->upload($dropboxFile, "/" . $fileName, ['autorename' => true]);
  12.  
  13. // File Uploaded
  14. echo $uploadedFile->getPathDisplay();
  15. } catch (DropboxClientException $e) {
  16. echo $e->getMessage();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement