Learn how to make the most out of the Dropbox Community here 💙!
Forum Discussion
Robert S.138
9 years agoHelpful | Level 7
Getting File Metadata after doing upload - Android
To upload in Android I am using sDbxClient.files().uploadBuilder(pathName) .withMode(WriteMode.OVERWRITE) .uploadAndFinish(inputStream); which returns, what? The docs say it returns t...
- 9 years ago
R is the response, containing the metadata of the uploaded file. So, for example in this case you could do something like:
FileInputStream inputStream = new FileInputStream(localPath); try { FileMetadata fileMetadata = client.files().uploadBuilder(remotePath) .withMode(WriteMode.OVERWRITE) .uploadAndFinish(inputStream); System.out.println(fileMetadata.getName()); System.out.println(fileMetadata.getServerModified()); } finally { inputStream.close(); }
Greg-DB
Dropbox Staff
9 years agoR is the response, containing the metadata of the uploaded file. So, for example in this case you could do something like:
FileInputStream inputStream = new FileInputStream(localPath); try { FileMetadata fileMetadata = client.files().uploadBuilder(remotePath) .withMode(WriteMode.OVERWRITE) .uploadAndFinish(inputStream); System.out.println(fileMetadata.getName()); System.out.println(fileMetadata.getServerModified()); } finally { inputStream.close(); }
Robert S.138
9 years agoHelpful | Level 7
Thanks, it seems to work. I thought it might be something like that. But starting from the official docs for uploadAndFinish, all I could see was that it returned type R. Where in the docs was I supposed to see that R was FileMetadata in this case?
- Greg-DB9 years ago
Dropbox Staff
UploadBuilder gives you an UploadUploader which is documented as DbxUploader<FileMetadata,UploadError,UploadErrorException>.
That's definitely unclear/difficult to find if you're looking at uploadAndFinish itself though, so I'll ask the team to clarify that in the documentation. Thanks!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,975 PostsLatest Activity: 5 years ago
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 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!