We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
abhishek9851
8 years agoExplorer | Level 3
Java Batch upload via uploadSessionAppendV2
I am trying to batch upload multiple files via uploadSessionAppendV2, but somehow all the files are written to a single file.
Lets say i have two identical files file1.txt, file2.txt , each with si...
- 8 years agoIt looks like you're only calling uploadSessionStart once. You'll need to call that once per file. That is, a single "upload session" is used to upload a single file. You can use uploadSessionFinishBatch to finish multiple different upload sessions at once though.
abhishek9851
8 years agoExplorer | Level 3
Cant figure it out how to delete the post, so i ll just post the answer about how to upload files in parallel.
UploadSessionCursor cursor = null; for (int i = 1; i <= 100; i++) { try { file = localFiles.get(i); remoteFileName = remoteFilePath + "/" + file.getName(); currentPath = file.getAbsolutePath(); try (InputStream in = new FileInputStream(currentPath)) { sessionId = getCleint().files().uploadSessionStart(true).uploadAndFinish(in).getSessionId(); offset = file.length(); cursor = new UploadSessionCursor(sessionId, offset); System.out.println("uploaded " + currentPath + " offset" + offset); CommitInfo commitInfo = new CommitInfo(remoteFileName, WriteMode.OVERWRITE, false, new Date(), false); UploadSessionFinishArg arg = new UploadSessionFinishArg(cursor, commitInfo); entries.add(arg); } catch (Exception e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } } try { System.out.println("Batch entries commit"); LaunchEmptyResult result = getCleint().files().uploadSessionFinishBatch(entries); while (getCleint().files().uploadSessionFinishBatchCheck(result.getAsyncJobIdValue()).isInProgress()) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } UploadSessionFinishBatchJobStatus status = getCleint().files().uploadSessionFinishBatchCheck(result.getAsyncJobIdValue()); System.out.println(status.toString()); } catch (Exception e) { e.printStackTrace(); }
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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 or Facebook.
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!