cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more 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 chunks of file data to a file in dropbox

Uploading chunks of file data to a file in dropbox

Shashikanth
Explorer | Level 3

Hello,

 

My scenario:

In the application I am working I have to upload chunk of file data and append to a file in dropbox. In the application I will not know the source file name. All I get, through a method call is a ByteBuffer and name of the file on DropBox. I need to upload this chunk of data. The method could be called a number of times depending on file size. For example:

 

public boolean write (ByteBuffer buf, String drpbxFileName) {

    // Need to upload the data in buf to a file in dropbox.

}

 

Any suggestions on how I can achieve this? I use Java.

 

I thought of using uploadSessionStart and uploadSessionAppendV2 methods for writing the first chunk. But I don't seem to get how I can pass data to uploadSessionAppendV2 method when the next chunk of file data comes with next call to write method.

 

Thanks

 

 

 

3 Replies 3

Greg-DB
Dropbox Staff

If you're using Java, we do recommend using the official Dropbox API v2 Java SDK. There's an example of uploading files included, for both uploading small files, as well as uploading larger files using upload sessions.

 

To clarify though, do you need to append data to an existing uploaded file? Note that you can append to an upload session by calling uploadSessionAppendV2 as many times as you need, but you need to upload the entire file each time you want to update it. That is, each "upload session" is a way to update a single file to a whole new version of that file, but uploading all of the data for that file version.

Shashikanth
Explorer | Level 3

Thank you for the reply.

 

Yes, I need to append data to an existing file on Dropbox. Uploading entire file each time is not an option for me because the data to be appended comes in as an input to my method. So all I have is a byte array which needs to be appended to a file on Dropbox. 

 

 

Greg-DB
Dropbox Staff
Thanks for following up. The API doesn't offer the ability to append like that unfortunately. I'll pass this along as a feature request.
Need more support?