cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Re: Uploading to *my* Dropbox with control over folder

Uploading to *my* Dropbox with control over folder

Ryan F.5
New member | Level 1

Hi,

I am a lecturer and I'm looking to create a coursework submission system for our students, many of whom create very large files (>5GB - they are film students). I've tried to link into Google Drive for this and have hit a roadblock in as much as their Picker (my preferred way of doing things - I want to remove the need to store uploaded files on my server when at all possible) will not allow for refreshed authorisation in the client library. So it will work for 1hour, then the auth token times out, and I am unable to get a new one without authenticating in the browser as me, which defeats the object.

So, here's what I want to do - can anyone give me some guidance on how best to implement? I've tried looking at Core API and got the basics of the theory under my belt, but the implementation is driving me crazy.

  1. I create an App in Dropbox that points to my Dropbox account (probably in an App folder).
  2. I authenticate with the app in code so that I have an access token that I can store privately and use when creating API calls in my web app - meaning my students never see Dropbox logins at all when accessing my app - it "runs" as me, and uploads files they choose to *my Dropbox*
  3. I have a form on my website to upload a file/files of pretty much any size. Ideally, I'd use the Chooser/Saver interface for this as a. it's standardised and b. it uses Dropbox's backend, so I don't have to mess around with chunking an upload to my server temp space to simply send it to Dropbox
  4. The form is password protected (I have done this) and will have expiration time/dates (again, I can do this).
  5. Resulting upload folder is shared with student and me (eventually, other tutors as well) so I can simply upload feedback into the Dropbox folder and student sees it automatically.

I have considered doing this through a convoluted sharing set up (e.g. manually create a folder for each student, share it with them) but a. that does not scale well past about 10 students, b. it doesn't handle case edges well and c. not every student will have or want to have a Dropbox account.

So, any ideas please? If I'm asking for the impossible, could someone let me down gently :)? Also, I have researched services like DBInbox and the like and whilst they have some of my intended functionality they do not cover all areas, hence my desire to roll my own.

Thanks
Ryan

4 Replies 4

Ryan F.5
New member | Level 1

Forgot to mention - I usually code in PHP, if that makes any difference. I can do HTML, CSS, JS, MySQL, C#, Obj-C and a couple of other things as well if that helps...

Greg-DB
Dropbox Staff

I'll start by saying this isn't impossible, but some pieces may be a manual process right now. 🙂 The API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. However, it is technically possible to connect to just one account, as you described. It's generally not recommended, but with a server-side app like you describe, there isn't much of a security concern (like there is when doing this with a client-side app).

A few notes:

  1. Most just a note on vocabulary, but Dropbox API apps don't "point" to any particular account. They are "owned" by the account that registers them, but that doesn't automatically enable access to that account via that app. That only happens in your item 2.

  2. Sounds right.

  3. If you let your users use the Dropbox Chooser (in the case where they do have a Dropbox account) you have the choice of two different kinds of links:

  • "direct": This kind of link expires after four hours, and would let your app access the student's chosen file content directly (i.e., the app makes a GET request to download the content). Your app would have to download the content and re-upload it to your Dropbox though. This is of course somewhat inefficient. We're tracking some feature requests that would enable more efficient solutions here, but there's currently nothing available to help on this point.

  • "preview": This kind of link doesn't expire, but gives you a preview web page of the file itself. From there, you can download the file or efficiently add it to your own account. The latter is a manual process as there's currently no API endpoint for doing so. (It's just a button on the web page.)

Also, in the case where the student does have a Dropbox account, there is an alternative and much more efficient way of doing this, but it would require them to authorize your app to access their own account to, which isn't what you had in mind. For reference though, it would involve getting a "copy reference" to the file in their account once they linked the app and then copying that file into your account using that copy reference (see the from_copy_ref parameter).

.5. Unfortunately, there currently isn't an API for managing shared folders (e.g., creating new shared folders and inviting people) so this would have to be a manual process. However, if you'd be interested in potentially participating in shared folder API beta in the future, please sign up here.

The programming language doesn't make much of a difference here in any case. The above documentation links are all for the underlying HTTP API. We do recommend using one of our official SDKs whenever possible though.

Hope this helps!

Greg-DB
Dropbox Staff

Quick follow up here on #3, we now have an endpoint for saving a file to a Dropbox account via a URL:

https://blogs.dropbox.com/developers/2015/06/programmatically-saving-a-url-to-dropbox/

Ryan F.5
New member | Level 1

Hi Greg - thanks for the update. I'll have a look over the new documentation and let you know if I have any issues - but it seems to be exactly what I needed, thank you!

Need more support?