<?php
//unique id for attachment
$tmpname = tempnam("/tmp", md5(uniqid(rand(),true)));

// Move the uploaded file the the tmpname
move_uploaded_file($_FILES["file"]["tmp_name"], $tmpname);

//returns query string to script file
echo "&attachment_id=".basename($tmpname)."&name=".$_FILES["file"]["name"];
?>