One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
tannchri
9 years agoExplorer | Level 4
iOS API v2: possible to overwrite files at upload?
I'm using the objective-c SDK for Dropbox API v2 and trying to do something which should be remarkably simple: upload text files to the user's Dropbox folder and if any changes are made to the file o...
- 9 years ago
You can certainly overwrite files using the API. For example, use -uploadData:mode:autorename:clientModified:mute:inputData: and pass in the desired 'mode' parameter, which should be a DBFILESWriteMode. You can use the 'overwrite' mode, but using 'update' with a rev value is safer, as it prevents accidentally overwriting new data the app wasn't aware of.
Greg-DB
Dropbox Staff
9 years agoYou can certainly overwrite files using the API. For example, use -uploadData:mode:autorename:clientModified:mute:inputData: and pass in the desired 'mode' parameter, which should be a DBFILESWriteMode. You can use the 'overwrite' mode, but using 'update' with a rev value is safer, as it prevents accidentally overwriting new data the app wasn't aware of.
- tannchri9 years agoExplorer | Level 4
Thank you!
Though I'm still having trouble with this, and am unable to find any resolution elsewhere. Is this not the correct way to write this? "
dbclient.filesRoutes uploadData:fileName mode:DBFILESWriteModeOverwrite ..."
- Greg-DB9 years ago
Dropbox Staff
That woud look like this:
NSString *path = ... NSData *data = ... DBFILESWriteMode *mode = [[DBFILESWriteMode alloc] initWithOverwrite]; [[client.filesRoutes uploadData:path mode:mode autorename:false clientModified:nil mute:false inputData:data] response:^(DBFILESFileMetadata *metadata, DBFILESUploadError *routeError, DBRequestError *error) { if (metadata) { NSLog(@"%@\n", metadata); } else { NSLog(@"%@\n%@\n", routeError, error); } }];
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,953 PostsLatest Activity: 5 months 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!