Sorry also dann probier ich die Sache ein bischen abzukürzen
hier ist erst mal das Forumular wo die Daten eingeben werden- das müsste aber richtig sein
Code:
<table width="95%" id="rundrum" bgcolor="#f1f5f6" cellspacing="3" cellpadding="3">
<tr>
<td width="180" ><h3>Bild:*</h3> </td>
<td><form name="formen" action="bildertest.php" method="post" enctype="multipart/form-data"> <input type="file" name="datei"/> </td>
</tr>
<tr>
<td width="180"><h3>Produkt:*</h3></td>
<td><h3><select name="typ"><option value="RT1101">RT1101</option><option value="RT1102">RT1102</option>
<option value="RT2101">RT2101</option><option value="RT2110">RT2110</option>
<option value="RT2121">RT2121</option><option value="RT2130">RT2130</option>
<option value="Sondertyp">Sondertyp </option></select>
/ <input id="inputklein" type="text" name="strichnummer"/></h3></td>
</tr>
<tr>
<td width="180"><h3>Ansicht:*</h3></td>
<td><select name="ansicht"><option value="Vorderansicht">Vorderansicht</option><option value="Rückansicht">Rückansicht</option></select></td>
</tr>
<tr>
<td width="180" ><h3>P-Nummer:*</td>
<td ><h3>P-<input type="text" name="p_nummer"/><?php echo "<input type=\"hidden\" value=\"Bild$counterstand\" name=\"dateiname\" />" ?></h3> </td>
</tr>
<tr>
<td valign="top" width="180" ><h3>Kommentar:</h3></td>
<td><textarea type="text" name="kommentar"></textarea> </td>
</tr>
<tr>
<td width="180" ><h3>Hochgeladen von:*</h3></td>
<td><input type="text" name="author"/></td>
<tr>
<td width="180" ><h5>* Pflichtfelder</h5></td>
<td ><input type="submit" value="Bild hinzufügen" name="submit"/><input type="hidden" name="MAX_FILE_SIZE" value="10000"/></center><br></form>
</td>
</tr>
<tr>
<td width="180" ><h1></h1></td>
<td >
und hier noch der Php Code dazu der eigentlich den Fehler enthalten muss
wenn ich auf hochladen klicke passiert nichts, das heisst es wird kein Bild hochgeladen. Ich hab z.B die Schreibweise
PHP-Code:
if ($dateiname==""){
print "<font color=\"red\"> Bitte geben sie einen Dateinamen ein!<font color=\"red\">";
$ok = 0;
in folgende Schreibweise abgeändert
PHP-Code:
if ($_POST['dateiname'] ==""){
print "<font color=\"red\"> Bitte geben sie einen Dateinamen ein!<font color=\"red\">";
$ok = 0;
und hier nochmal der ganze php Code
PHP-Code:
<?php
if ($_POST['folder'] == "Choose folder")
{
echo "Error: ";
}
$path="bilder";
$pfad="bilder/";
$laenge_Dateiname = strlen($_POST['dateiname']);
$laenge_p_nummer = strlen($_POST['p_nummer']);
$laenge_author = strlen($_POST['author']);
$laenge_strichnummer = strlen($_POST['strichnummer']);
$info = getimagesize ($_POST['datei'] );
$righttyp="0";
if ($info[2] =="1") {$ending =".gif" and $righttyp="1";}
if ($info[2] =="2") {$ending =".jpg" and $righttyp="1";}
if ($info[2] =="3") {$ending =".png" and $righttyp="1";}
if ($info[2] =="4") {$ending =".swf" and $righttyp="1";}
if ($_POST['datei'] && $_POST['dateiname']){
$ok = 1;
if ($righttyp=="1")
{ if ($info[0] <="601")
{
if ($laenge_Dateiname >= "25"){
print "<font color=\"red\"> Der Dateiname ist zu lang (max 30 Zeichen)!";
$ok = 0;
}
if (is_file($pfad.$_POST['dateiname'].$ending)){
print "<font color=\"red\"> Bitte geben sie einen anderen Dateinamen ein, dieser Name existiert schon!";
$ok = 0;
}
if ($_POST['dateiname'] ==""){
print "<font color=\"red\"> Bitte geben sie einen Dateinamen ein!<font color=\"red\">";
$ok = 0;
}
if ($_POST['p_nummer'] =="" or $laenge_p_nummer!="7"){
print "<font color=\"red\"> Bitte geben sie eine korrekte P-Nummer ein (7Stellen)!<font color=\"red\">";
$ok = 0;
}
if ( $_POST['strichnummer']=="" or $laenge_strichnummer!="3" ){
print "<font color=\"red\"> Bitte geben sie eine Nummer nach dem Schrägstrich bei Produkt ein (max. 3Stellen)!<font color=\"red\">";
$ok = 0;
}
if (preg_match("/^[\/\\\.]/", $_POST['dateiname'])){
print "<font color=\"red\"> Der Dateiname darf keine Sonderzeichen enthalten<font color=\"red\">";
$ok = 0;
}
if ($laenge_author >= "20"){
print "<font color=\"red\"> Der Name ist zu lang (max 20 Zeichen)!";
$ok = 0;
}
if ($_POST['author'] ==""){
print "<font color=\"red\"> Bitte gebe sie ihren Namen ein! <font color=\"red\">";
$ok = 0;
}
}
else
{
print "<font color=\"red\"> Das Bild ist zu breit";
$ok = 0;
}
}
else
{
print "<font color=\"red\"> Achtung falscher Dateityp - Es sind folgende Endungen erlaubt: .jpg, .gif, .png, .swf<br />" ;
$ok = 0;
}
print "";
}
if ($ok){
$res = copy($_POST['datei'], $path."/".$_POST['dateiname'].$ending);
print ($res)?"<img src=\"../bilder/acceptklein.png\" alt=\"\" /> <font color=\"green\">Die Datei wurde erfolgreich hochgeladen</font> <br>
":"<font color=\"red\">Error, konnte die Datei nicht hochladen.<br></font>";
$zeitpunkt = time();
$eintrag = "INSERT INTO bilder_db (P_Nummer, Ansicht, Author, Typ, Terminal_typ, Dateiname, Dateiendung, Datum, Kommentar)
VALUES ('$_POST[p_nummer]','$_POST[ansicht]','$_POST[author]', '$_POST[typ]', '$_POST[strichnummer]', '$_POST[dateiname]', '$ending','$zeitpunkt', '$_POST[kommentar]')";
$eintragen = mysql_query($eintrag);
echo (mysql_error());
}
?>