title: Send parameter with image by POST method?
body: <p>I want to send my image with parameter (username, password..etc) ?? following is my code:</p>
  
  <pre><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:@"&amp;username=%@&amp;password=%@&amp;image=%@&amp;answer=%@&amp;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!");
  }
  </code></pre>
  
  <p>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 ??</p>
  
  <p>So, please suggest me what I need to change in my existing code for add functionality of send image ??</p>
  
  <blockquote>
    <p><strong>NOTE:</strong> without image this above code is working well for me.</p>
  </blockquote>