title: Security issues and parsing data iPhone to Server
body: <p>I have an iPhone that uploads <code>jpg</code> images to folder <code>'uploads'</code> on a remote server. This is done using a asynchronous method on the iOS, which connects to a PHP script. The PHP script then handles the image. The PHP script is simple and looks as follows : </p>
  
  <pre><code>$uploaddir = './uploads/';
  $file = basename($_FILES['userfile']['name']);
  $uploadfile = $uploaddir . $file;
  
  if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
          echo "http://iphone.zcentric.com/uploads/{$file}";
  }
  </code></pre>
  
  <p>How can I improve the security to know that it is the correct iPhone that is connecting to the PHP script?. Also, how can I create a folder that has an unique name to the iphone device so the images are stored inside it, rather than in the '<code>uploads</code>' server?. e.g. the iPhone connects to the PHP Script, the script verifies the iPhone and gets an unique identifier (i'm not sure what that unique identifier can be, perhaps imei?), and creates a folder e.g. <code>M234SFDFS/image.jpg</code></p>