title: ASIHTTPRequest File Upload and PHP
body: <p>I am using the following code (with ASIHTTPRequest) to attempt to upload php files from my iPhone to my LAN MAMP server running on my Macbook Pro.  My objective-c and my php seem to be in line, but the files are not uploading.</p>
  
  <p>OBJECTIVE-C CODE</p>
  
  <pre><code>    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *path = [paths objectAtIndex:0];
  [path stringByAppendingPathComponent:[pieces objectAtIndex:indexPath.row]];
  
  NSURL *url = [NSURL URLWithString:@"http://192.168.1.102:8888/upload.php"];
  
  
  ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
  [request setFile:path forKey:@"file"];
  </code></pre>
  
  <p>PHP CODE</p>
  
  <pre><code> &lt;?php
  $target = "uploads/";
  $target = $target . basename( $_FILES['file']['name']) ;
  $ok=1;
  (move_uploaded_file($_FILES['file']['tmp_name'], $target));
  ?&gt;
  </code></pre>
  
  <p>What is going wrong here?</p>
  
  <p>Thanks, </p>
  
  <p>James</p>