One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
sesha
6 years agoExplorer | Level 4
Upload from Android application
I am uploading files from android phone to my Dropbox. The path/directory where I am writing is Apps/p19
my upload code does the following: But this never succeeds.
mDBApi.putFile("Apps/p19/t.csv",inputStream, filename.length(), null, null);
Is my path wrong or am i making any mistake in the putFile call ?
- Greg-DB
Dropbox Staff
It looks like there are a few issues here:
- Based on "mDBApi.putFile", it looks like you're using an old and now retired Dropbox API (v1) and SDK. You should instead use Dropbox API v2. For accessing Dropbox API v2 from Android, we recommend using the official Dropbox API v2 Java SDK. There's an example Android app using it here. For uploading files, you can use the upload method.
- When specifying a non-root path, e.g., to indicate where the uploaded file should go, the path should start with a "/".
- If your app is registered for the "app folder" permission, you shouldn't include the "/Apps/<app folder name>" portion of the path. When making a call using an access token for an app with the app folder permission, the Dropbox API will automatically translate it to be relative to the app folder. So, you should just supply a path like "/t.csv".
- seshaExplorer | Level 4
Thanks. it worked with v2 api
- aliazazNew member | Level 2
How can I upload files to a specific folder in android
- aliazazNew member | Level 2
got the answer:
FileInputStream(file).use { item ->
val metadata = client.files().uploadBuilder("/$rootPATH/${file.absolutePath.substringAfterLast("/")}")
.uploadAndFinish(item)
}
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,945 PostsLatest Activity: 7 hours 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!