Two queries while sending a file from iphone

| | August 5, 2015

I am sending a file to server, but at server I see that two queries recieved, one without any files and one with file, why? I tried to send custom post query but it still have two requests.

           Alamofire.upload(Method.POST, URLString: "http://posttestserver.com/post.php?dir=tst", headers: nil,
           multipartFormData: { multipartFormData in
               multipartFormData.appendBodyPart(data: UIImageJPEGRepresentation(avatar, 0.7), name: "file", fileName: "avatar.jpg", mimeType: "image/jpeg")
           },
           encodingCompletion: { encodingResult in
               switch encodingResult {
               case .Success(let upload, _, _):
                   upload.responseString { request, response, string, error in
                       println(string)
                   }
               case .Failure(let encodingError):
                   println(encodingError)
               }
           })

Leave a Reply