cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload via API

Upload via API

Paul W.
New member | Level 1

Hello,
I just installed a Dropbox Plugin for a social network tool called ELGG which uses the Dropbox API. There seems to be a problem with the upload - so I want to ask you, whether you see an error in the following code:

 /* Need to be logged in to do this. */
gatekeeper();

/* Get the path. */
$path = get_input('path');

/* Get the file. */
$file = $_FILES['file']['name'];

/* Redirect the user if Cancel is clicked. */
$submit = get_input('submit');
if ($submit == elgg_echo('cancel')) {
    forward('pg/dropbox/root/?path=' . $path);
}

/* Upload file procedure */
try {
    /* Connection to dropbox. */
    $ret = dropbox_connect();
    if ($ret) {
        forward('pg/dropbox/error/?errcode=' . $ret);
    }

    $CONFIG->dropbox->putFile($path . '/' . $file, $_FILES['file']['tmp_name']);

    system_message(sprintf(elgg_echo('dropbox:upload:uploaded'), $file));
    forward('pg/dropbox/root/?path=' . $path);
} catch (Dropbox_Exception_NotFound $e) {
    register_error(elgg_echo('dropbox:notfound'));
    forward($_SERVER['HTTP_REFERER']);
} catch(Dropbox_Exception_Forbidden $e) {
    register_error(elgg_echo('dropbox:forbidden'));
    forward('pg/dropbox/root/?path=' . $path);
}

Thanks for help!

1 Reply 1

Greg-DB
Dropbox Staff

What problem exactly do you encounter? Do you get an error message? I can't offer much help with third party plugins of course, but if you are getting an error from the API I may be able to offer some insight.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?