ios - Overwriting file with DropboxSDK -
i'm using dropboxsdk (core api). upload file function:
- (void)uploadfile { [[self restclient] loadmetadata:@"/myfolder"]; } - (void)restclient:(dbrestclient *)client loadedmetadata:(dbmetadata *)metadata { if (metadata.isdirectory) { if (metadata.contents.count == 0) { nsstring *filename = @"file.txt"; nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdir = [documentpaths objectatindex:0]; nsstring *databasepath = [documentsdir stringbyappendingpathcomponent:filename]; nsstring *destdir = @"/myfolder"; [[self restclient] uploadfile:filename topath:destdir withparentrev:nil frompath:databasepath]; } else { (dbmetadata *file in metadata.contents) { [self overwritefile:metadata]; } } } }
i try overwrite file "file.txt" function, doesn't work.
- (void)overwritefile:(dbmetadata*)meta { nsstring *filename = @"file.txt"; nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdir = [documentpaths objectatindex:0]; nsstring *databasepath = [documentsdir stringbyappendingpathcomponent:filename]; [[self restclient] uploadfile:filename topath:meta.path withparentrev:meta.rev frompath:databasepath]; }
call delegate:
- (void)restclient:(dbrestclient *)client uploadedfile:(nsstring *)destpath from:(nsstring *)srcpath metadata:(dbmetadata *)metadata { nslog(@"file uploaded path: %@", metadata.path); }
and show in log: file uploaded path: /myfolder/file.txt. go dropbox , see, date of file doesn't change.
what wrong? can me?
note uploadfile
uploads file named filename
within path topath
. looks me you're trying upload /myfolder/file.txt/file.txt
. make sure topath
folder want write file file.txt
.
Comments
Post a Comment