We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Tom A.5
8 years agoNew member | Level 2
batchUpload - I want to upload one file to 3 or 4 dropbox paths.
We need to hopefully efficently upload about a single local file into about 3 - 4 locations on a users dropbox. I am using the objective-c api, but this question is not api version specific. ...
- 8 years ago
Hello Tom A.5,
There may be a few options for this. Some things for you to try:
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_batchWill allow the upload once, copy-many process to possibly be consolidated to fewer calls.
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-get
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-save
Might be interesting to look at especially if you need to replicate the content between more than one user/account. You could upload once, and then replicate across accounts without having to upload again, all replication happens on the Dropbox side so it's pretty efficient.
Another option is the upload session mechanism:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-starthttps://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2
But if I am reading your post correctly - this isn't about one file stored in many places, it's about many files stored in many places (though the same "set" of files repllicated in all areas) - is that correct?
If so, then even with upload sessions, you'd need to upload every file to every location before doing the finish batch calls. So if you are talking data efficiency (I assume this is a mobile device?) then upload once, and copy (via whatever method you think works best) might be the best option, despite requiring multiple API calls.
Let me know if I am interpreting your question correctly and if any of these options might fit.
Thanks,
-Chuck
chirstius
Dropbox Staff
8 years agoHello Tom A.5,
There may be a few options for this. Some things for you to try:
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_batch
Will allow the upload once, copy-many process to possibly be consolidated to fewer calls.
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-get
https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-save
Might be interesting to look at especially if you need to replicate the content between more than one user/account. You could upload once, and then replicate across accounts without having to upload again, all replication happens on the Dropbox side so it's pretty efficient.
Another option is the upload session mechanism:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2
But if I am reading your post correctly - this isn't about one file stored in many places, it's about many files stored in many places (though the same "set" of files repllicated in all areas) - is that correct?
If so, then even with upload sessions, you'd need to upload every file to every location before doing the finish batch calls. So if you are talking data efficiency (I assume this is a mobile device?) then upload once, and copy (via whatever method you think works best) might be the best option, despite requiring multiple API calls.
Let me know if I am interpreting your question correctly and if any of these options might fit.
Thanks,
-Chuck
- Tom A.58 years agoNew member | Level 2
Thanks for the quick reply!
You have it right - what we are doing is uploading about 3 - 20 files into one user's account, with each file going to 4 places. So I am using batch upload already to get the files up, then I am going to make a list of instructions to use the files-copy_batch call to make the 3 copy calls (since the file is up there on the user account). There may be a small window of time (<1sec it seems) where the user could erase the originally uploaded file. Don't think that's going to happen much. Its on MacOS. It's making thousands of files (archival PDF files) in the user's dropbox account.
I wish that the DBFILESCommitInfo object had a way to pass in an array of paths to copy to, instead of one file...
--Tom
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! I'll pass this along as a feature request for that DBFILESCommitInfo in the Objective-C SDK.- Tom A.58 years agoNew member | Level 2
https://www.dropboxforum.com/t5/API-Support-Feedback/copy-batch/td-p/211624
So I am running into the same bug as the one above.
I call dCopyBatch
Then I call to get the status of the copy with dCopyBatchCheck and I get:
I have the source from_path repeated and then
Printing description of self->_uploadCopyBatchInfos:
<
__NSArrayM 0x6040006b3e50>( { "from_path" = "/FOLDER_1/Chicopee.jpg"; "to_path" = "/FOLDER_2/Chicopee.jpg"; }, { "from_path" = "/FOLDER_1/Chicopee.jpg"; "to_path" = "/FOLDER_3/Chicopee.jpg"; }, }And I get back "duplicated_or_nested_paths"
The source IS duplicated, but that should be OK as I am copying files.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!