<?
        # $userf = $file;
		$userf = $_FILES['file']['tmp_name'];
        $fname = $HTTP_POST_FILES['file']['name'];

   if($fname!=""){
 
        $fp = fopen ($userf, "rb");
		$fileSize = $_FILES['file']['size'];
#        $fileSize = filesize($userf);
        $contents = fread($fp,$fileSize);
        fclose($fp);
        if ($fileSize<10000000){
              
                $directory="../bilder/galerien/kat";
               
	        $fname=eregi_replace(" ","-",$fname);  
	        $fname=eregi_replace("Ü ","Ue",$fname);  
	        $fname=eregi_replace("ü","ue",$fname);  
	        $fname=eregi_replace("Ä ","Ae",$fname);  
	        $fname=eregi_replace("ä ","ae",$fname);  
	        $fname=eregi_replace("ö ","oe",$fname);  
	        $fname=eregi_replace("Ö ","Oe",$fname);  
		
	        $fname=$last_id."_".$fname; 
                $fp = fopen("$directory/$fname","wb");
                fwrite($fp, $contents);
        } else {
                echo "<hr> Die Datei ist zu groß!!!<hr>";
        }
        fclose($fp);
$destination ="$directory/$fname";
 
/*$img_array = GetImageSize($destination);

if($img_array[2]== "1"){ $type = ".gif"; }
if($img_array[2]== "2"){ $type = ".jpg"; }
if($img_array[2]== "3"){ $type = ".png"; }
if($img_array[2]== "4"){ $type = ".swf"; }
$X_0=$img_array[0];
$Y_0=$img_array[1];
$type_0=$type;*/     
}          
?>
