0
我正在使用restkit庫REST Services.I不知道如何發送多個圖像,我可以發送單個圖像,我不知道。使用restkit上傳多個圖像?
[LoadingView showInView:[[UIApplication sharedApplication].delegate window]];
NSString *[email protected]"/upload";
NSDictionary *[email protected]{@"userId":[self.appUtil getDataForKey:@"USERID"]};
NSMutableURLRequest *request = [[RKObjectManager sharedManager] multipartFormRequestWithObject:nil method:RKRequestMethodPOST path:url parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:UIImagePNGRepresentation(imgProfile.image)
name:@"file"
fileName:@"photo.png"
mimeType:@"image/png"];
}];
RKObjectRequestOperation *operation = [[RKObjectManager sharedManager] objectRequestOperationWithRequest:request success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){
NSString* userString=operation.HTTPRequestOperation.responseString;
NSLog(@"%@",userString);
NSError* error = nil;
[LoadingView removeFromView:[[UIApplication sharedApplication].delegate window]];
StatusInnner *state=[[StatusInnner alloc]initWithString:userString error:&error];
if (state!=nil) {
if ([state.status.status isEqualToString:@"200"]) {
[self.appUtil createSimpleAlertView:self title:string_title_success
message:state.status.msg];
}else{
[self.appUtil createSimpleAlertView:self title:string_title_success
message:state.status.msg];
}
}
上FORMDATA循環檢查我的答案,如果您需要任何幫助,然後讓我知道 –