多文件上传 iOS功能

 多文件上传 iOS功能,原文来自ios教程网整理的,大家可以看看演示:ios.662p.com ,喜欢的朋友可以看看我的博客吧。

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[]"];
        }
    }

  详细说明:http://ios.662p.com/thread-1651-1-1.html

posted on 2014-04-28 13:38  chenkaiyuan  阅读(394)  评论(0编辑  收藏  举报

导航