I need to send a pic to a server via HTTP post, but I am getting a response from server saying that I used POST+GET. Any ideas what I did wrong? Here is my code.
- (void)sendMessagesWithImg
{
NSMutableData *body = [NSMutableData data];
UIImage *imgColor = [UIImage imageNamed:@"imgbar.png"];
UIImage * imageToPost = [[UIImage alloc] init];
imageToPost = [self convertImageToGrayScale:imgColor];
// add image data
NSData *imageData = UIImageJPEGRepresentation(imageToPost, 1.0);
if (imageData) {
[body appendData:imageData];
}
[imgView setImage:imageToPost];
[body appendData:imageData];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"URL"]];
[request setHTTPBody:body];
[request setHTTPMethod:@"POST"];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[conn start];
}
Server response
More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected.