当前位置:编程学习 > wap >>

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

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

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 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,