你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> 怎樣實現多文件上傳 在iOS開發中

怎樣實現多文件上傳 在iOS開發中

編輯:關於IOS

NSURL* url = [NSURL URLWithString:@"ios開發教程www.51ios.net"]; 
    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:@"ios開發教程www.51ios.net"];
    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[]"];
        }
    }
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved