ios - Upload multiple images using AFNetworking -


i used pickercontroller , loaded few images on nsmutablearray.

now need upload of these images @ once. using afnetworking , how can this?

i went through afnetworking documentation , there section called creating upload task multi-part request, progress. however, not able upload images in nsmutablearray.

**** nb: want upload images in nsmutablearray byte array. how can this? ****

the code have far

nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration defaultsessionconfiguration]; afurlsessionmanager *manager = [[afurlsessionmanager alloc] initwithsessionconfiguration:configuration];  nsurl *url = [nsurl urlwithstring:@"site.com/upload"]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; 

uiimage *image1 = [uiimage imagenamed:@"about_app"]; uiimage *image2 = [uiimage imagenamed:@"alter"]; nsarray *array = @[image1,image2]; nsmutableurlrequest *request = [[afnetworksingleton shareinstance] multipartformrequestwithmethod:@"post" path:@"mindex/getimg" parameters:nil constructingbodywithblock:^(id<afmultipartformdata>formdata){ int = 0; for(uiimage *eachimage in array) {     nsdata *imagedata = uiimagejpegrepresentation(eachimage,0.5);     [formdata appendpartwithfiledata:imagedata name:[nsstring stringwithformat:@"file%d",i ] filename:[nsstring stringwithformat:@"file%d.jpg",i ] mimetype:@"image/jpeg"];     i++; } }]; 

try this.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -