title: Error to Upload Image on server from iphone
body: <p>I am trying to upload photo on server using php. Actually I want to upload photo on server with save name in mysql database request with ASIFormDataRequest. I want upload photo on local server directory folder.</p>
  
  <pre><code>  if ([arrImages count] &gt; 0) {
       NSString *strURL = @"http://localhost/ApneAreaMein/upload_file.php";
  
     ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:strURL]];
  
  [request setDelegate:self];
  [request setPostValue:@"This is sample text..." forKey:@"company_logo"];//Here write down the text which will be sent.
  
  for (int i = 0; i &lt; [arrImages count]; i++) {
  
      [request addData:[arrImages objectAtIndex:i] withFileName:@"image.jpg" andContentType:@"image/jpeg" forKey:[NSString stringWithFormat:@"image%d", i + 1]];
  }
  [request startAsynchronous];
  }
  else {
  UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Please         select images..." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
  [alertView show];
   }
  </code></pre>
  
  <h1>My Php Code is</h1>
  
  <pre><code>&lt;?php
  
  $con = mysql_connect('localhost','root');
   mysql_select_db('apnemein_forms',$con);
  
   $uploaddir = 'http://localhost/apneareamein/uploads/'; //folder named upload, where       image will be saved (same dir as this file)
  $file = basename($_FILES['company_logo']['company_logo']);
  
   $uploadfile = $uploaddir . $file;
  
   if (move_uploaded_file($_FILES['company_logo']['tmp_name'], $uploadfile))
  {
   echo "File not uploaded"; //i'm not sure about this, but it works for me like this
   }
   else
   {
   echo "&lt;img src=\"uploads/photopicker.jpg\" /&gt;";
  }
  
   ?&gt;
  </code></pre>