In my iOS app I want to upload an image file and some other parameters through API. image file contains multiple images.
You can use custom image pickers like ELCImagePickerController
There is also some other library that can be used.. WSAssetPickerController QBImagePickerController
These allow you to pick multiple images. let me know how things go
By Using AFNetworking You can upload multiple image as below code, download AFNetworking
Other Parameter :
NSDictionary *parametersAll = @{@"Value": @"Key"};
NSArray *imageArray;
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseUrl: my_url ];
NSMutableRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:nil
parameters:parametersAll constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {
for(UIImage *img in imageArray)
{
[formData appendPartWithFileData: my_imageData name:@"image" fileName:@"myImage.jpg" mimeType:@"image/jpeg"];
}
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest: request];
[operation start];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.