title: How to send Image and text together to xmpp server?
body: <p>I have send text message and Image through below code but i would like send this together how can manage this?</p>
  
  <pre><code>-(void)myImage
  {
  
  NSString *strMessage;
  
  UIImage *image = [UIImage imageNamed:@"bg_i5.png"];
  //  NSString *path = [[NSBundle mainBundle] pathForResource:@"kamlesh" ofType:@"JPG"];
  
  if(image){
      //NSData *dataObj = UIImagePNGRepresentation(image);
  
      NSData *dataObj = UIImageJPEGRepresentation(image, 0);
      //     UIImage *image = [UIImage imageWithData:dataObj];
      //   NSError *error;
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
  
      NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"image"]; //Add the file name
  
      [dataObj writeToFile:filePath atomically:YES];
  
  
  
      NSData *plainTextData = [filePath dataUsingEncoding:NSUTF8StringEncoding];
      strMessage = [plainTextData base64EncodedString];
  
      // strMessage =  [dataObj base64Encoding];
  
  } else {
      strMessage =  @"";
  }
  
  
  
  
  NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
  [body setStringValue:@"image"];
  
  NSXMLElement *attachment = [NSXMLElement elementWithName:@"attachment"];
  [attachment setStringValue:strMessage];
  
  
  NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
  [message addAttributeWithName:@"type" stringValue:@"chat"];
  [message addAttributeWithName:@"to" stringValue:@"12598221@test-desktop"];  //1313112 878899100
  [message addChild:body];
  [message addChild:attachment];
  
  
  [[self xmppStream] sendElement:message];
  }
  
  -(void)SenMessage
  
  { 
  NSString *messageStr = sendMessagetxt.text;
  
  if([messageStr length] &gt; 0) {
  
  
  
      UserDetails *details=[UserDetails new];
  
      NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
      [body setStringValue:messageStr];
  
      NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
      [message addAttributeWithName:@"type" stringValue:@"chat"];
      [message addAttributeWithName:@"to" stringValue:@"12598221@test-desktop"];
      [message addChild:body];
      details.JUserbody=messageStr;
      details.JUserName=@"123456789@shrikant-desktop";
      details.messStatus=@"1";
      [self.xmppStream sendElement:message];
      [app.AllContactUser addObject:details];
      [details release];
  
      XMPPJID *jid = [XMPPJID jidWithString:chatWithUser];
  
      NSLog(@"Attempting TURN connection to %@", jid);
       }
  
  sendMessagetxt.text=@"";
  
  }
  </code></pre>
  
  <p>How can I send text and image together in single body?</p>
  
  <p>thanks</p>