You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
dougnull
3 years agoExplorer | Level 4
how do I set my Swift Dropbox API .upload to overwrite
How do I make .upload overwrite the file if it's already in dropbox?
When my swift tries to upload an updated file, I get "API route" error if file already in dropbox.
I tried this:
let request = client!.files.upload( path: dropbox_upload_pathname, input: fileData, WriteMode: overwrite )
..but got error "Cannot find 'overwrite' in scope."
I tried these but get build errors...
client!.files.upload( path: dropbox_upload_pathname, WriteMode: overwrite, input: fileData)
client!.files.upload( path: dropbox_upload_pathname, input: fileData, WriteMode: overwrite)
[Cross-linking for reference: https://stackoverflow.com/questions/72060987/how-can-i-overwrite-a-file-using-dropbox-api-in-ios-swift#72060987 ]
The upload method takes a 'mode' parameter, for which the value should be a Files.WriteMode, like this:
client.files.upload(path: dropbox_upload_pathname, mode: Files.WriteMode.overwrite, input: fileData) .response { response, error in if let response = response { print(response) } else if let error = error { print(error) } }
For reference, you can use "overwrite", but "update" is recommended, as it's safer.
- Greg-DBDropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/72060987/how-can-i-overwrite-a-file-using-dropbox-api-in-ios-swift#72060987 ]
The upload method takes a 'mode' parameter, for which the value should be a Files.WriteMode, like this:
client.files.upload(path: dropbox_upload_pathname, mode: Files.WriteMode.overwrite, input: fileData) .response { response, error in if let response = response { print(response) } else if let error = error { print(error) } }
For reference, you can use "overwrite", but "update" is recommended, as it's safer.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days 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!