I can upload a single file without any issues but now I find that I need to upload 1 or more files, does anyone know how to do this with AFNetworking?
Any help would be most appreciated.
Use a multipartFormRequest
NSURLRequest* request = [[YourHTTPClient sharedHTTPClient] multipartFormRequestWithMethod:@"POST"
path:path
parameters:dict
constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:data1
name:@"image1"
fileName:@"image1.jpg"
mimeType:@"image/jpeg"];
[formData appendPartWithFileData:data2
name:@"image2"
fileName:@"image2.jpg"
mimeType:@"image/jpeg"];
}
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With