title: iOS upload image file NSData and get POST PHP variables
body: <p>I been avoiding the ASIFormDataRequest a bit because it did not quite fit my needs and had too much code for my simple needs.</p>
  
  <p>SO:</p>
  
  <p>I found a few other pieces of code, yet none of which managed to transfer and vraiables or the image data over as the image doesn't show up and the response doesn'y show the vars.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>NSData * imageData = myImageData;
  
  NSString *urlString = [[self getDBCGIFolder] stringByAppendingString:DATABASE_PATH_UPLOAD_PORTRAIT];
  
  NSString *values = @"&amp;accountID:";
  values = [values stringByAppendingString:myAccountID];
  values = [values stringByAppendingString:@"&amp;shit:"];
  values = [values stringByAppendingString:@"SHITE"];
  NSData *valueData = [values dataUsingEncoding:NSUTF8StringEncoding];
  
  NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
  [request setURL:[NSURL URLWithString:urlString]];
  [request setHTTPMethod:@"POST"];
  
  NSLog(urlString);
  
  NSMutableData *postBody = [NSMutableData data];
  [postBody appendData:[NSData dataWithData:imageData]];
  [postBody appendData:[NSData dataWithData:valueData]];
  
  
  [request setHTTPBody:postBody];
  
  // now lets make the connection to the web
  NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
  NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
  
  NSLog(@"--%@", returnString);
  </code></pre>
  
  <p>This code got me furthest with a solid reply string in XML that lets me check the arriving data in the PHP script, but no data seems to get there.</p>
  
  <p>Anyone?</p>