// [formData appendPartWithFileData:imageData name:@"file" fileName:fileName mimeType:@"mp4"]
// }else {
// [formData appendPartWithFileData:imageData name:@"file" fileName:fileName mimeType:@"image/png"]
// }
// [formData appendPartWithFileData:(NSData*)[unitData objectForKey:@"image"] name:@"image" fileName:@"image" mimeType:@"multipart/form-data"]
NSString *fileName = [NSString stringWithFormat:@"%@.png", str]
[formData appendPartWithFileData:[[unitData objectForKey:@"image"] dataUsingEncoding:NSUTF8StringEncoding] name:@"file" fileName:fileName mimeType:@"image/png"]
}
参考如下: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[]"]
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)