https://github.com/Alamofire/Alamofire install this pod
Try using the following code to upload multiple images to the server code:
Alamofire.upload( .POST, urlString, multipartFormData: { multipartFormData in for image in images { if let imageData = UIImageJPEGRepresentation(image, 0.1) { multipartFormData.appendBodyPart(data: imageData, name: "file", fileName: "file.jpeg", mimeType: "image/jpeg") } } }, encodingCompletion: { encodingResult in switch encodingResult { case .Success(let upload, _, _): upload.responseJSON(completionHandler: { (response) -> Void in if response.result.error != nil { print("Something is wrong while uploading images.") } else { } }) case .Failure(let encodingError): print(encodingError) } } )
Phani sai
source share