I want to send my image with parameter (username, password..etc) ?? following is my code:
-(void) senRequestForPostAnswerWithImage:(NSString *)imageName andAnswer:(NSString *)answer andQuestionID:(NSString *)questionID
{
    NSUserDefaults *loginData = [NSUserDefaults standardUserDefaults];
    NSString *username = [loginData objectForKey:@"username"] ;
    NSString *password = [loginData objectForKey:@"password"];
    NSString *postString = [NSString stringWithFormat:@"&username=%@&password=%@&image=%@&answer=%@&question_id=%@", username, password, imageName, answer, questionID];
    NSString *urlString = @"http://myAPIName/MethodName";
    NSURL *myURL = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSMutableURLRequest *detailRequestToServer =[NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0];
    [detailRequestToServer setHTTPMethod:@"POST"];
    [detailRequestToServer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    const char *utfString = [postString UTF8String];
    NSString *utfStringLenString = [NSString stringWithFormat:@"%zu", strlen(utfString)];
    [detailRequestToServer setHTTPBody:[NSData dataWithBytes: utfString length:strlen(utfString)]];
    [detailRequestToServer setValue:utfStringLenString forHTTPHeaderField:@"Content-Length"];
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:detailRequestToServer delegate:self];
    if (theConnection)
    {
        self.responseData = [[NSMutableData alloc] init];
        [GeneralClass startHUDWithLabel:@"Loading…"];
    }
    else
        NSLog(@"Connection Failed!");
}
I know there are many question on this site but I don't know where and what I need to change in my existing code ??
So, please suggest me what I need to change in my existing code for add functionality of send image ??
NOTE: without image this above code is working well for me.
 
     
     
     
     
     
     
    