I have an iPhone that uploads jpg images to folder 'uploads' 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 :
$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}";
}
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 'uploads' 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. M234SFDFS/image.jpg