I'm trying to upload files to Dropbox. Upload is not working. The upload method is given below.
// RootViewController.m
-(NSString *)getDocumentPath{
开发者_StackOverflow社区 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0]stringByAppendingPathComponent:FILENAME];
return path;
}
-(IBAction)download:(id)sender{
NSLog(@"download pressed");
[self.activityIndicator startAnimating];
[self.restClient loadFile:@"/dbTutorial.plist" intoPath:[self getDocumentPath]];
}
-(IBAction)upload:(id)sender{
NSLog(@"upload pressed");
[self.activityIndicator startAnimating];
NSString *path = [self getDocumentPath];
[self.itemArray writeToFile:path atomically:YES];
[self.itemArray uploadFile:FILENAME toPath:@"/" fromPath:path];// When I build this is the warning that I get:NSMutableArray may not respond to -uploadFiletoPath:fromPath
}
Thank you very much. Any help would be greatly appreciated.
It should be
[self.restClient uploadFile:FILENAME toPath:@"/" fromPath:path];
- (void)uploadPhoto
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Kallol.jpg"];
NSString *pathString = @"/Photos";
[self.restClient uploadFile:@"Kallol12.jpg" toPath:pathString fromPath:path];
}
I tried with above code and work nicely.........
精彩评论