title: Copy image to server directory from iPhone
body: <p>Based on a tutorial I've build an iOS app that uploads images from the device to an web server directory. It worked fine in my localhost, but when I uploaded the files to the server and tested the file weren't copied to the directory I specified! So I suppose in Xcode everything working correctly, the PHP file I using to upload to my server is bellow:</p>
  
  <pre><code>&lt;?php 
  
  $connect = mysql_connect("xxxxxxxxx","xxxx","xxxx") or die(mysql_error());
  $connectDB = mysql_select_db("xxxxxxxxx");
  
  $insertData = "INSERT INTO feras (nome,vulgo,imagelink) VALUES ('".$_GET['feraname']."','".$_GET['feravulgo']."','http://localhost:8888/ImageUpIPhone/uploads/".$_GET['imagelink'].".jpg')";
  $sendData = mysql_query($insertData);
  
  //$file_name = substr ( md5(uniqid(rand(),1)), 5, 15); 
  $file_name = $_GET['imagelink'];
  
  $uploaddir = 'uploads/';
  $file = basename($_FILES['userfile']['name']);
  $newname = $file_name . $file;
  $uploadfile = $uploaddir . $newname;
  
  if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
          $imagepath =  "http://example.com/uploads/{$newname}";
  }
  print $imagepath;
  ?&gt;
  </code></pre>
  
  <p>So, how can I fix that? In my localhost it worked and in the server it doesn't, I can only figure that's about the directory! I using a free host (ueuo.com).</p>