怎样实现多文件上传 在iOS开发中

NSURL* url = [NSURL URLWithString:@"xxx"];
    ASIFormDataRequest* request = [ASIFormDataRequest requestWithURL:url];
    request.uploadProgressDelegate = viewPost.progressView;
    request.showAccurateProgress = YES;
    request.shouldContinueWhenAppEntersBackground = YES;
    
    if ([imageArray count] > 0)
 {
        [request setPostFormat:ASIMultipartFormDataPostFormat];
        for (NSData* data in imageArray) {
            NSInteger idx = [imageArray indexOfObject:data];
            [request addData:data withFileName:[NSString stringWithFormat:@"image%d.png",idx] andContentType:@"image/png" forKey:@"photos[]"];
        }
    }

 



更多ios技术尽从这里开始

 

posted @ 2013-06-24 21:31  爱生活,爱编程  阅读(1072)  评论(0编辑  收藏  举报