Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

dropbox uploader was not working #26

Closed
aneeshtclt opened this issue Apr 29, 2014 · 7 comments
Closed

dropbox uploader was not working #26

aneeshtclt opened this issue Apr 29, 2014 · 7 comments

Comments

@aneeshtclt
Copy link

For the past 4 days the dropbox uploader was not working . It was suddenly stopped. Please check this.
ERROR


Fatal error: Uncaught exception 'Exception' with message 'Upload failed!' in /home/icampuz/Backup/DropboxUploader.php:131 Stack trace: #0 /home/icampuz/Backup/dropboxBackup_ngi.php(8): DropboxUploader->upload('/home/icampuz/b...', 'backup', 'ngi_db.zip') #1 {main}

thrown in /home/icampuz/Backup/DropboxUploader.php on line 131

@MarielleDijs
Copy link

It seems 'https://dl-web.dropbox.com/upload' is not working/not there anymore. I guess that would be the problem.
Is there a fix for this?

@aneeshtclt
Copy link
Author

Looks like Dropbox added '_subject_uid' and 'mtime' to post requets parameters.

$postData = array(
'plain' => 'yes',
'file' => '@' . $source,
'dest' => $remoteDir,
't' => $token,
'_subject_uid' => '1532641',
'mtime' => '1348870752'
);

mtime you can get using php's time() function.

For _subject_uid, login to your dropbox account, scroll over any file you have in it and check out the hyperlink. There will be a _subject_uid parameter in the hyperlink.

@MarielleDijs
Copy link

You say I should add that block of code and then it will work again? Do you mean in the DropboxUploader.php scrips?
And would that be within this line of code:
protected function request($url, $post=false, $postData=array()) {

In the script that is communicating with DropboxUpload.php I have:
$uploader = new DropboxUploader('username', 'password');
$uploader->upload(file, dest);

Hope you can help!

@aneeshtclt
Copy link
Author

You can see a piece of code like

$postData = array(
'plain' => 'yes',
'file' => '@' . $source,
'dest' => $remoteDir,
't' => $token
);
in DropboxUploader.php

and replace with

$postData = array(
'plain' => 'yes',
'file' => '@' . $source,
'dest' => $remoteDir,
't' => $token,
'_subject_uid' => '1532641',
'mtime' => '1348870752'
);

For _subject_uid, login to your dropbox account, scroll over any file you have in it and check out the hyperlink. There will be a _subject_uid parameter in the hyperlink.

mtime you can get using php's time() function.

@MarielleDijs
Copy link

Aneeshtclt,
Thank you so much! For the answer and the very quick response. It is working again :)

@aneeshtclt
Copy link
Author

For modified time, you can use these code
date_default_timezone_set("Asia/Calcutta"); // your timezone
$date = new DateTime(null);
$timestamp = $date->getTimestamp() + $date->getOffset();

@hakre
Copy link
Collaborator

hakre commented May 6, 2014

Duplicate of #25 ; fixed in 36db8b5

@hakre hakre closed this as completed May 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants