Iphone ASITPPost多文件
我希望使用HTTP post多文件 有可能吗。对于一个文件,我知道代码是:Iphone ASITPPost多文件,iphone,Iphone,我希望使用HTTP post多文件 有可能吗。对于一个文件,我知道代码是: [request setFile:[documentsDirectory stringByAppendingPathComponent:@"img1.png"] forKey:@"img"]; 所有图像文件都有相同的键“img” 欢迎任何评论您可以为此创建多个请求对象。您可以多次调用此方法,如下所示: for(int i=0; i<3 i++) [uploadRequest setFile:do
[request setFile:[documentsDirectory stringByAppendingPathComponent:@"img1.png"] forKey:@"img"];
所有图像文件都有相同的键“img”
欢迎任何评论您可以为此创建多个请求对象。您可以多次调用此方法,如下所示:
for(int i=0; i<3 i++)
[uploadRequest setFile:docFile forKey:[NSString stringWithFormat:@"uploadfile%d",i]];
for(int i=0;i[self-setNetworkQueue:[ASINetworkQueue]];
[[self-networkQueue]setDelegate:self];
对于(int i=1;i
[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];