I am beginner in iOS Development and have just started using the DropBox SDK for developing an App.
I am currently using XCode 3.2.5 and using the Simulator version 4.2. I wanted to know if there was any way by which we can directly upload the contents of an entire folder(directory) containing n number of files to our App account using DropBox SDK for iPhone.
I went across the discussions in various forums across the net, but could not find an answer to solve this problem. Is there a possible work-around solution for this problem. If yes, how can we implement it? Can you please help.
EDIT: I have looked up the API in DropBox SDK version 1.1 for iOS, but, it does not have any facility to upload an a directory or all of its contents recursively. So, Will I have to traverse recursively over the contents of a directory and send multiple requests? Please help.
Easiest way to accomplish this is like this:
NSFileManager *fmgr = [NSFileManager defaultManager]; NSString *localDirectoryPath = @"path/to/directory"; NSArray *subPaths = [fmgr subpathsOfDirectoryAtPath:localDirectory error:&error]; for(NSString *path in subPaths){ BOOL isDir; NSString *localPath = [userDir URLByAppendingPathComponent:path].path; [fmgr fileExistsAtPath:localPath isDirectory:&isDir]; if(!isDir){ NSString *filename = [path lastPathComponent]; NSString *destPath = [[[@"/" stringByAppendingPathComponent:@"base/path"] stringByAppendingPathComponent:path.stringByDeletingLastPathComponent] stringByAppendingString:@"/"]; [[self restClient] uploadFile:filename toPath:destPath withParentRev:nil fromPath:localPath]; } }
click here: https://github.com/chrishulbert/CHBgDropboxSync
for uploading & downloading dropbox folder/direcotry.
Read And Use the Contents Within Following Link
http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html
This Definatly helps You.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.