max: bild upload

Beitrag lesen

moin,
wäre echt nett wenn jemand von euch weiter wüsste, ich bin am verzweifeln. ich steh total aufm schlauch und komm einfach nicht drauf was an diesem script falsch ist:

function upload(){

if ($_GET[done]=="yes"){

$path = "pix/labels/";
$max_size = 200000;

if (!isset($HTTP_POST_FILES['userfile'])) {echo"Fehler beim Upload!";exit;}

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {

if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "The file is too big<br>\n"; exit; }
if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg")) {

if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "The file already exists<br>\n"; exit; }

$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);
if (!$res) { echo "upload failed!<br>\n"; exit; } else { echo "upload sucessful<br>\n"; }

echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>\n";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>\n";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>\n";
} else { echo "Wrong file type<br>\n"; exit; }
}
}
else{
echo"<form enctype="multipart/form-data" action="administration.php?PHPSESSID=".session_id()."&action=upload&id=".$_GET[id]."&done=yes" method="post">
Label-Datei: <input type="file" name="userfile">
<Input type="submit" value="Upload">
</form>";
}

}

wenn ich das ganze in ne extra datei packe funktionierts, aber als function läuft nix. die datei wird wohl nicht "geposted".
vielen dank schonmal!!!
max