$uploaddir = "pix/".$_POST['uname']."--/";
mkdir($uploaddir,0777);
$part = explode(".",$_FILES['userpic']['name']);
$extends = $part[1];
$extends =strtolower($extends);
if (($extends != "jpeg") && ($extends != "jpg") && ($extends != "gif"))
{
echo "Es ddürfen nur gif- und jp(e)g- Dateien hochgeladen werden.";
}
else
{
$uploadfile = $uploaddir . $_POST['uname'] .".". $extends;
}
if ($size > "30000")
{
echo "Die Datei hochzuladene Datei ist zu groß!- max. 30kB erlaubt..";
}
if (move_uploaded_file($_FILES['userpic']['tmp_name'], $uploadfile))
{
echo "File is valid, and was successfully uploaded. ";
echo "Here's some more debugging info:";
chmod ($uploadfile, 0777);
}
else
{
echo "error";
print_r($_FILES);
}
echo "[TEST]
uploaddir: ".$uploaddir."
filename: ".$_FILES['userpic']['name']."
extends: ".$extends."
uploadname für chmod: ".$uploadfile;