2011-05-09 111 views
0

我试图将文件上传到Dropbox。上传不起作用。上传方法如下。如何将文件上传到Dropbox ios

// RootViewController.m 

-(NSString *)getDocumentPath{ 

    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 


} 

非常感谢。任何帮助将不胜感激。

回答

1

应该 [self.restClient uploadFile:FILENAME toPath:@"/" fromPath:path];

+0

能否请你告诉我,我怎么可以跟踪上传进度? (无效)restClient:(DBRestClient *)客户端uploadProgress:(CGFloat)进度 forFile:(NSString *)destPath from :(NSString *)srcPath; 但无法如何使用此... – Meet 2012-06-18 12:26:51

1
- (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]; 

} 

我试着用上面的代码,并很好地工作.........

+0

你有没有试图保持上传的轨道?如果是,请告诉...谢谢 – Meet 2012-06-18 12:31:15