title: Trying upload data in Local Server using MKNetworkKit
body: <p>I want to upload data, images, txt files, pdf documents , etc.
  Im using MKNetworkKit to connect cleanly. With examples of this framework i try do it.
  I add to my proyect a class extends of MKNetworkEngine with a method for upload from file:</p>
  
  <pre><code>#import "MKNetworkOperation.h"
  #import "MKNetworkEngine.h"
  
  @interface Uploader : MKNetworkEngine
  -(MKNetworkOperation*) uploadFromFile:(NSString*) file 
                                onError:(MKNKErrorBlock) errorBlock; 
  @end
  
  
  
  #import "Uploader.h"
  
  @implementation Uploader
  
  
  -(MKNetworkOperation*) uploadFromFile:(NSString*) file 
                                onError:(MKNKErrorBlock) errorBlock 
  {
  
      MKNetworkOperation *op = [self operationWithPath:@"IP:PORT/PROYECT/" 
                                                params:nil
                                            httpMethod:@"POST"];
  
      [op addFile:file forKey:@"upload"];
      [op setFreezable:YES];
  
      [op onCompletion:^(MKNetworkOperation* completedOperation) 
       {
           NSString *xmlString = [completedOperation responseString];
           NSUInteger start = [xmlString rangeOfString:@"&lt;mediaurl&gt;"].location;
            if(start == NSNotFound) 
            {
            NSLog(@"%@", xmlString);
            errorBlock(nil);
            return;
            }
            xmlString = [xmlString substringFromIndex:start + @"&lt;mediaurl&gt;".length];
            NSUInteger end = [xmlString rangeOfString:@"&lt;/mediaurl&gt;"].location;
            xmlString = [xmlString substringToIndex:end];
       }
               onError:^(NSError* error) 
       {
           errorBlock(error);
       }];
  
      [self enqueueOperation:op];
      return op;
  
  }
  @end
  </code></pre>
  
  <p>I have added i my interface a button for upload file, and in my controller i,ve created a method with this content:</p>
  
  <pre><code>-(IBAction)uploadImageTapped:(id)sender 
  {
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
  
      NSString *cachesDirectory = [paths objectAtIndex:0];
      NSString *uploadPath = [NSString stringWithFormat:@"%@/Imagen.jpg",cachesDirectory];
      //NSLog(@"%@",uploadPath);
  
      self.uploadOperation = [ApplicationDelegate.sampleUploader uploadFromFile:uploadPath  onError:^(NSError* error) 
                              {
                                  [UIAlertView showWithError:error];
                              }];
    }
  </code></pre>
  
  <blockquote>
    <p>Finally I,ve added a Uploader object in my delegate of app:</p>
  </blockquote>
  
  <pre><code>@property (strong, nonatomic) Uploader *sampleUploader;
  </code></pre>
  
  <blockquote>
    <p>and</p>
  </blockquote>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      // Override point for customization after application launch.
      UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
      UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
      splitViewController.delegate = (id)navigationController.topViewController;
  
      //Uploader
      self.sampleUploader = [[Uploader alloc] initWithHostName:@"http://IP:PORT"
                                            customHeaderFields:nil];
  
      return YES;
  }
  </code></pre>
  
  <p>My problem is that i want to can upload files, my localhost is not reachable and i dont know  why.... </p>
  
  <p>Any ideas???</p>