How can I upload a File (graphic, audio and video file) with Android using the Dropbox API to Dropbox? I followed the tutorial on the Dropbox SDK Android page and could get
According to the latest documentation of dropbox API V2:
// Create Dropbox client
val config = DbxRequestConfig.newBuilder("dropbox/java-tutorial").build()
client = DbxClientV2(config, getString(R.string.token))
// Uploading file
FileInputStream(file).use { item ->
val metadata = client.files().uploadBuilder("/${file.absolutePath.substringAfterLast("/")}")
.uploadAndFinish(item)
}
And if you want to overwrite file then add this to client:
.withMode(WriteMode.OVERWRITE)
.uploadAndFinish(item)