2012-04-05 17 views
0

我希望使用ASIHttp後多文件 是否有可能。對於一個文件,我所知道的代碼是:asihttp後多文件

 [request setFile:[documentsDirectory stringByAppendingPathComponent:@"img1.png"] forKey:@"img"]; 

所有圖像文件具有相同的密鑰「IMG」

歡迎任何評論

回答

0

您可以創建多個爲此請求對象。

1

,你可以這樣調用這個方法對多個時間:

for(int i=0; i<3 i++) 
    [uploadRequest setFile:docFile forKey:[NSString stringWithFormat:@"uploadfile%d",i]]; 
0
[self setNetworkQueue:[ASINetworkQueue queue]]; 
[[self networkQueue] setDelegate:self]; 

for (int i=1; i<numberoffiles; i++) 
{ 
    NSString* filename = [NSString stringWithFormat:@"img%d.jpg", i]; 
    NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:filename]; 
    [request setFile:path forKey:[NSString stringWithFormat:@"fileCount%d", i]]; 
    [[self networkQueue] addOperation:request]; 
} 
[[self networkQueue] go];