Forum Discussion

ankur's avatar
ankur
New member | Level 2
8 years ago

API v2 upload file with DBFILESWriteModeAdd not working

Hello,

I am using API v2 iOS sdk for upload files from my device. I want to add new files every time is file already exist. thats why i am using DBFILESWriteModeAdd for upload. But its not create new fileor even replace. I got success message after upload. Here is my code.

DBUserClient *client = [DBClientsManager authorizedClient];
DBFILESWriteMode *mode = [[DBFILESWriteMode alloc] initWithOverwrite];
NSString *destDir = @"/text.m4a"
DBUploadTask *restClient = [[[client.filesRoutes uploadData:destDir
                                               mode:mode
                                         autorename:@(YES)
                                     clientModified:nil
                                               mute:@(NO)
                                          inputData:fileData]
                     setResponseBlock:^(DBFILESFileMetadata *result, DBFILESUploadError *routeError, DBRequestError *networkError) {
                         if (result)
                         {
                         }
                         else
                         {
                         }
                     }] setProgressBlock:^(int64_t bytesUploaded, int64_t totalBytesUploaded, int64_t totalBytesExpectedToUploaded)
                        {
                        });
                     }];
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    Are you uploading the same data again? If the data is exactly the same as what already exists at the destination path, no conflict will occur and it won't create a renamed copy.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 hours ago
352 Following

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!