title: Converting UIImage into NSData
body: <p>I need to upload a image from iOS device to web service. While uploading image i used;</p>
  
  <pre><code>    NSData* pictureData = UIImagePNGRepresentation(originalImage);
  </code></pre>
  
  <p>Actually it works fine. However the images i uploaded does not show up in IE. 
  I tried uploading both JPG and PNG i can see the images in all other browsers but it does not work in IE. So i thought that it can be about converting it to NSData. </p>
  
  <p>Is there any other way to convert UIImage to NSData?</p>
  
  <p>Or any other idea that might be causing the problem?</p>
  
  <p>Here is the way i upload the image;</p>
  
  <pre><code>NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
  [request setValue:contentType forHTTPHeaderField: @"Content-Type"];
  
  NSMutableData *body = [NSMutableData data];
  
  NSData* pictureData = UIImagePNGRepresentation(originalImage);
  
  if (pictureData) {
      [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"image.JPG\"\r\n", FileParamConstant] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[@"Content-Type: image/jpeg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:pictureData];
      [body appendData:[[NSString stringWithFormat:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
  }
  
  [body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
  </code></pre>