Below is a little sample from something I just got done writing...If you want more, I can supply it...in this code, I set a cookie when the user logs in and just use the value from that cookie to make the dir..
$dir = "./snippets/".$cookie_user."";
mkdir($dir, 0777);
If (!copy($uploaded_data, "".$dir."/download.php"))
{
$error = 1;
$ErrorString .= "Error - Could not upload file!<br>";
}
The $uploaded_data is the name of the file field in the form...