Hi,
ich möchte mit folgendem Code ein bild hochladen & in eine MySQL-DB schreiben:
	
Doch ich bekomme immer einen Fehler in der Form  
	
		
Schreibrechte Stimmen, PHP_Upload ist erlaubt. was mache ich falsch???
Daniel
					ich möchte mit folgendem Code ein bild hochladen & in eine MySQL-DB schreiben:
PHP-Code:
	
	
<?php
include("include.php");
?>
<html>
<head>
<title>Reisen - Hinzufügen</title>
</head>
<body bgcolor="#ffffff">
    <?php
    if($action == "upload") {
        if(empty($title)) {
        echo "Bitte geben Sie einen Titel an!<br>";
        $wrong = 1;
        }
        if(empty($country)) {
        echo "Bitte geben Sie das Land an!<br>";
        $wrong = 1;
        }
        if(empty($name)) {
        echo "Bitte geben Sie Ihren Namen an!<br>";
        $wrong = 1;
        }
        
        if(empty($text)) {
        echo "Bitte geben Sie einen Text an!<br>";
        $wrong = 1;
        }
        if(empty($file)) {
        echo "Sie müssen eine Datei übertragen!<br>";
        $wrong = 1;
        }
        if($file_size >= $file_max_size) {
        echo "Die Datei ist zu gross! Sie können Dateien bis max. $file_max_size übergeben!<br>";
        $wrong = 1;
        }
        $size = GetImageSize($file);
        if(empty($size[2])) {
        $wrong = 1;
        }
        else {
            for($n=0; $n<=count($filetype); $n++) {
                if($filetype[$n] == $filetype1[$size[2]]) {
                $file_ok = 1;
                break;
                }
            }
        }
        if(empty($file_ok)) {
        echo "Dateityp nicht erlaubt!<br>Bitte beachten Sie, dass Sie nur Bilddateien uploaden dürfen!<br>";
        $wrong = 1;
        }
        if(!empty($file_ok)) {
        $size = getimagesize($file);
            if($size[0] >= $image_width) {
            echo "Ihre Grafik ist zu breit! Sie darf maximal $image_width Pixel breit sein!<br>";
            $wrong = 1;
            }
            if($size[1] >= $image_height) {
            echo "Ihre Grafik ist zu hoch. Sie darf maximal $image_height Pixel hoch sein!<br>";
            $wrong = 1;
            }
        }
        if(!empty($wrong)) {
        echo "<a href=\"javascript:history.back()\">Zurück</a><br>";
        }
        if(empty($wrong)) {
            $n=0;
            while(file_exists($imagedir."/".$n.$file_name)) {
            $n++;
            }
            $imagepath = $imagedir."/".$n.$file_name;
                if(copy($file, $imagepath)) {
                echo "Datei wurde erfolgreich gespeichert!<br>";
                }
                else {
                echo "Datei konnte nicht gespeichert werden!<br>";
                }
            $connect = mysql_connect($db_server, $db_user, $db_password);
            mysql_select_db($db_name);
            if(mysql_query("insert into $table(title, country, name, text, imagepath, activ, time)
            values('$title', '$country', '$name', '$text', '$imagepath', 0, ".time().")")) {
            echo "Text wurde erfolgreich gespeichert!<br>";
            mysql_close($connect);
            }
            else {
            echo "Fehler: ".mysql_error();
            }
        }
    }
    if(empty($action)) {
    ?>
    <form method="post" action="<?php echo $PHP_SELF; ?>?action=upload" enctype="multipart/formdata">
    <input type="text" size="30" name="title"> Titel<br>
    <input type="text" size="30" name="country"> Land<br>
    <input type="text" size="30" name="name"> Von<br>
    <textarea name="text" cols="30" rows="10"></textarea>Text<br>
    <input type="text" name="file" size="30"><br>
    <input type="submit" value="Speichern">
    </form>
    <?php
    }
    ?>
</body>
</html>
			
			
				Warning: copy() [function.copy]: Unable to access 38_1.JPG in /home/www/web729/html/berichte/upload.php on line 90
Warning: copy(38_1.JPG) [function.copy]: failed to create stream: No such file or directory in /home/www/web729/html/berichte/upload.php on line 90
failed to copy 38_1.JPG...
Text wurde erfolgreich gespeichert!
	Warning: copy(38_1.JPG) [function.copy]: failed to create stream: No such file or directory in /home/www/web729/html/berichte/upload.php on line 90
failed to copy 38_1.JPG...
Text wurde erfolgreich gespeichert!
Daniel
          

Kommentar