title: How to convert UIImage or NSData to byte Array and post to server?
body: <p>How to convert <code>UIImage</code> or <code>NSDate</code> to byte array and post to server.
  In my app i have to convert <code>UIImage</code> to byte array and  i have to post.</p>
  
  <p>for post  i am using as <code>ASIFormDataRequest</code>.</p>
  
  <p><strong>My code is:</strong></p>
  
  <pre><code>NSUInteger len = [self.dataImage length];
   Byte *byteData= (Byte*)malloc(len);  //converting date to byte array
   [self.dataImage  getBytes:byteData length:len];
  
  
   ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:urlStr]];
    [request setRequestMethod:@"POST"];
  
  
   [request addData:self.dataImage withFileName:@"Image.png" andContentType:@"image/png" forKey:@"photo"];
   [request setDelegate:self];
   [request startAsynchronous];
  </code></pre>