cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We want to hear from you. What do you use Dropbox for?
Close

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: 
Highlighted

unable to upload files using javascript

New member | Level 2
New member | Level 2

Hi There!

Hope you are doing good. 

I get the following error when I try to upload the files to dropbox. I did the following to get the access token

1. Login to the Site

2. create a App

3. Generate the Access Token 

4. Use the token in the code

 

here is my code 

      xhr.setRequestHeader('Authorization''Bearer ' + dropboxToken);
      xhr.setRequestHeader('Content-Type''application/octet-stream');
      xhr.setRequestHeader('Dropbox-API-Arg'JSON.stringify({
      path: '/'+ folder  +  file.name,
      mode: 'add',
      autorename: true,
      mute: false
      }));
      
      xhr.send(file);

 

Error I get

"Error in call to API function "files/upload": This API function operates on a single Dropbox account, but the OAuth 2 access token you provided is for an entire Dropbox Business team. Since your API app key has team member file access permissions, you can operate on a team member's Dropbox by providing the "Dropbox-API-Select-User" HTTP header or "select_user" URL parameter to specify the exact user <https://www.dropbox.com/developers/documentation/http/teams>. "

 

 

Can some one please help me out here

2 Replies 2
Highlighted

Re: unable to upload files using javascript

Dropboxer
Dropboxer

You're getting this error because you're using an access token for an entire Business team to call a user-specific endpoint. You can do so, but you'll need to specify which team member to operate on. You can find information on how to do so under the "Member file access" section here:

https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access

Alternatively, if you don't want to connect to entire Business teams, and instead just want to connect to individual accounts (Business or not), you should register a "Dropbox API" app, instead of a "Dropbox Business API" app:

https://www.dropbox.com/developers/apps/create

Highlighted

Re: unable to upload files using javascript

New member | Level 2
New member | Level 2

Thanks Greg it worked

Polls
Do you know how to organize your files and folders?
<b>We have created a guide on folder best practice, so you can get organized now <a href="https://www.dropboxforum.com/t5/Business-Tips-tricks/Folder-structure-best-practice/m-p/428456#M39"><u>check it out here</u></a>.</b>

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?