title: Sending UIImage over NSOutputStream
body: <p>I'm trying to send an image that user takes to the server. I get the JPEG representation, append that to the string needed to upload the photo, and then send the data through NSOutputStream. However, when I try to get the photo back from server, I only see 10% of it from the top. Any help would be appreciated.</p>
  
  <p>btw. socket is open and connected.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>NSString *requestString = [NSString stringWithFormat:@"SubmitPhoto::%@::", userID];
  NSData * stringData = [requestString dataUsingEncoding:NSUTF8StringEncoding];
  
  NSData *imgData = UIImageJPEGRepresentation(image, 1.0);
  
  NSMutableData *completeData = [[NSMutableData alloc] initWithBytes:[stringData bytes] length:[stringData length]];
  [completeData appendData:imgData];
  
  //sending NSData over to server
  [self.outputStream write:[completeData bytes] maxLength:[completeData length]];
  </code></pre>