title: Upload Image Using AFNetwork
body: <p>I have searched a lot for a working uploading code using AFNetwork but no luck. I came up with this code which I got it from 2 different sites:</p>
  
  <pre><code>NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"1.png"]);
  NSURL *url = [NSURL URLWithString:@"http://localhost/project"];
  AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
  NSURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"upload.php" parameters:nil constructingBodyWithBlock: ^(id &lt;AFMultipartFormData&gt; formData) {
      [formData appendPartWithFileData:imageData name:@"google" fileName:@"1.png" mimeType:@"image/png"];
  }];
  
  
  AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
      NSLog(@"IP Address: %@", [JSON valueForKeyPath:@"origin"]);
  } failure:nil];
  
  [operation start];
  </code></pre>
  
  <p>But what I get is "IP Address: (null)". My php side is this:</p>
  
  <pre><code>function upload(){
  $uploaddir = 'uploads/';
  $file = basename($_FILES['file']['name']);
  $uploadfile = $uploaddir . $file;
  
  if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
      sendResponse(200, 'Upload Successful');
      return true;
  }
  sendResponse(403, 'Upload Failed');
      return false;
  }
  </code></pre>
  
  <p>I really appreciate a little help.</p>