PFranchise
PFranchise

Reputation: 6762

How can I upload a file to dropbox via javascript?

I am trying to allow users to upload large files without tying up my servers for an extended amount of time. I thought using dropbox as file storage might be a good solution. My plan is to use javascript to have the client-side connect directly to dropbox, so that my server is not affected.

I have been trying to find a current javascript dropbox api, but have not had much success. I tried using dropbox-js, but it seems that it is using an outdated version of the API as I get the following error with my current test: {"error": "You're using an older version of the Dropbox API with a new API key. Please use the latest version."}

Does anyone know a fairly simple way to accomplish this task?

Upvotes: 1

Views: 3394

Answers (1)

pwnall
pwnall

Reputation: 7134

  1. Set up your application as a Folder app. If things go wrong, at least you won't blow up people's Dropboxes.

  2. Follow these directions for obfuscating your API key and secret.

  3. Use writeFile to upload the files, and then use makeUrl with the downloadHack: true option, then send the URL to your server.

You'll need the git version of dropbox-js to use downloadHack until the 0.7.0 release comes out.

Upvotes: 2

Related Questions