[PHP] Bilder werden trotz Erfolgsmeldung nicht hochgeladen
Hallo,
ich habe einen News-Teil auf einer Website realisiert mit Hilfe des Artmedic-Aktuell PHP-Scripts. Es funktioniert alles super, bis auf die Tatsache, dass trotz Erfolgsmeldung keine Bilder hochgeladen werden. (Man muss dazu sagen, dass die Website momentan über Xampp / Wamp läuft). Wenn ich die Bilder manuell in das Upload-Verzeichnis kopiere, werden Sie dann auch problemlos dargestellt.
Ich vermute einfach mal, dass das Upload-Script eine Macke hat!
Hier mal das Script, das unter anderem für den Upload verantwortlich ist:
PHP-Code:
<html> <head> <title>Administration artmedic aktuell 2.0</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .titel { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #FFFFFF; text-decoration: none; } .titeldunkel { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #333366; text-decoration: none; } .text { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #333366; text-decoration: none; } .inputtext { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #660066; text-decoration: none; background-color: #FFFFFF; border: 1px solid #666699; } --> </style> </head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <?php if(!is_file("artmedic_aktuell_inc.php")) { echo "<br><br><center><p class=\"titeldunkel\">Es existiert noch keine Einstellungsdatei für artmedic aktuell!<br> Führen Sie zunächst Setup durch.<br> Klicken Sie <a href=\"artmedic_aktuell_setup.php\">hier</a>, um Setup durchzuführen.</p>"; exit;} ?> <p> </p> <table width="100%" height="100%" border="0" align="center" cellpadding="4" cellspacing="0"> <tr bgcolor="#666699"> <td height="20" colspan="2" class="titel">Administration artmedic aktuell 2.0</td> </tr> <tr> <td width="15%" valign="top" bgcolor="#6666CC"><p> </p> <p><a href="aktuell.php" target="_blank" class="titel">Anzeige einspaltig</a></p> <p><a href="aktuell2.php" target="_blank" class="titel">Anzeige zweispaltig</a></p> </td> <td width="85%" align="center" valign="top" bgcolor="#FFFFFF" class="inputtext"> <?PHP ############################################################################# # artmedic aktuell 2.0 # Copyright (c) 2003 Ellen Baitinger, http://www.artmedic.de (kontakt@artmedic.de) # # # This program is free software; # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #Dieses Script kann kostenlos auf privaten und kommerziellen Seiten eingesetzt und angepasst werden, #solange Sie den Link auf artmedic webdesign und die Hinweise auf das Copyright und die Autorenschaft intakt lassen. #Die Nutzung des Programms erfolgt auf eigene Gefahr. <br> #Das Programm darf nicht weiterverkauft oder in anderer Weise zu Geld gemacht werden. ############################################################################# require("artmedic_aktuell_inc.php"); if(isset($_POST['password'])){$password = $_POST['password'];} if(isset($_GET['password'])){$password = $_GET['password'];} $input = $_POST['input']; if(!isset($password) and !isset($input)) { ?> <p> </p> <table width="500" border="0" cellspacing="2" cellpadding="4"> <tr bgcolor="#666699"> <td class="titel">Passwort eingeben</td> </tr> <tr> <td bgcolor="#9999CC"> <form name="form2" method="post" action="artmedic_aktuell_admin.php"> <input name="password" type="password" class="inputtext" id="password"> <input type="submit" name="Submit3" value="einloggen"> </form> </td> </tr> </table> <?PHP } if(isset($password) and $password!=$passwort and !isset($input)) { ?> <table width="500" border="0" cellspacing="2" cellpadding="4"> <tr bgcolor="#666699"> <td colspan="2" class="titel">Passwort eingeben</td> </tr> <tr> <td width="100" nowrap bgcolor="#666699" class="titel">Falsches Passwort</td> <td width="392" bgcolor="#CCCCFF"> <form name="form2" method="post" action="artmedic_aktuell_admin.php"> <input name="password" type="password" class="inputtext" id="password"> <input type="submit" name="Submit3" value="einloggen"> </form> </td> </tr> </table> <?PHP } if($password==$passwort and !isset($input)) { ?> <table width="100%" border="0" align="center" cellpadding="4" cellspacing="0"> <tr bgcolor="#666699"> <td height="20" colspan="2" class="titel"> <a href="artmedic_aktuell_admin.php?password=<?PHP echo $password; ?>" class="inputtext"> Neue Meldung eingeben </a> <a href="artmedic_aktuell_delete.php?password=<?PHP echo $password; ?>" class="inputtext"> Aktuelle Meldungen löschen </a> <a href="artmedic_aktuell_deletearchiv.php?password=<?PHP echo $password; ?>" class="inputtext"> Archiv-Meldungen löschen </a></td> </tr> </table> <br> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td><form action="artmedic_aktuell_admin.php" method="post" enctype="multipart/form-data" name="form1"> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr bgcolor="#666699"> <td colspan="3" class="titel">Neue Meldung</td> </tr> <tr bgcolor="#6666CC"> <td colspan="3" class="titel">Startzeit eingeben (wenn die Anzeige ab sofort erfolgen soll, hier nichts eingeben)</td> </tr> <tr> <td width="13%" valign="top" bgcolor="#CCCCFF" class="titeldunkel">Datum</td> <td width="31%" nowrap bgcolor="#CCCCFF"> <input name="tagstart" type="text" class="inputtext" id="tag3" onKeyup="if (this.value.length == 2) document.all['form1'].monatstart.focus()" size="2" maxlength="2"> . <input name="monatstart" type="text" class="inputtext" id="monat3" onKeyup="if (this.value.length == 2) document.all['form1'].jahrstart.focus()" size="2" maxlength="2"> . <input name="jahrstart" type="text" class="inputtext" id="jahr2" onKeyup="if (this.value.length == 2) document.all['form1'].stundestart.focus()" size="2" maxlength="2"> </td> <td width="56%" bgcolor="#ECECFF" class="text">z.B. 19.08.02 </td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Uhrzeit</td> <td bgcolor="#CCCCFF"> <input name="stundestart" type="text" class="inputtext" id="stunde3" onKeyup="if (this.value.length == 2) document.all['form1'].minutestart.focus()" size="2" maxlength="2"> : <input name="minutestart" type="text" class="inputtext" id="minute3" onKeyup="if (this.value.length == 2) document.all['form1'].tagende.focus()" size="2" maxlength="2"> </td> <td bgcolor="#ECECFF" class="text">z.B. 20:15 (wenn Sie keine Uhrzeit eingeben, dann ist sie 00.00 Uhr)</td> </tr> <tr bgcolor="#6666CC"> <td colspan="3" valign="top" class="titel">Endzeit eingeben (wenn Sie hier nichts eingeben, erfolgt die Anzeige unbegrenzt lange)</td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Datum</td> <td bgcolor="#CCCCFF"> <input name="tagende" type="text" class="inputtext" id="tag22" onKeyup="if (this.value.length == 2) document.all['form1'].monatende.focus()" size="2" maxlength="2"> . <input name="monatende" type="text" class="inputtext" id="monat22" onKeyup="if (this.value.length == 2) document.all['form1'].jahrende.focus()" size="2" maxlength="2"> . <input name="jahrende" type="text" class="inputtext" id="jahr22" onKeyup="if (this.value.length == 2) document.all['form1'].stundeende.focus()" size="2" maxlength="2"> </td> <td bgcolor="#ECECFF" class="text">z.B. 19.08.02</td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Uhrzeit</td> <td bgcolor="#CCCCFF"> <input name="stundeende" type="text" class="inputtext" id="stunde22" onKeyup="if (this.value.length == 2) document.all['form1'].minuteende.focus()" size="2" maxlength="2"> : <input name="minuteende" type="text" class="inputtext" id="minute22" onKeyup="if (this.value.length == 2) document.all['form1'].titel.focus()" size="2" maxlength="2"> </td> <td bgcolor="#ECECFF" class="text"> z.B. 20:15 (wenn Sie keine Uhrzeit eingeben, dann ist sie 00.00 Uhr)</td> </tr> <tr bgcolor="#6666CC"> <td colspan="3" valign="top" class="titel">Eingabe der Informationen</td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Titel</td> <td colspan="2" bgcolor="#ECECFF"> <input name="titel" type="text" class="inputtext" id="titel2" size="50"> </td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Infotext</td> <td colspan="2" bgcolor="#ECECFF"> <textarea name="infotext" cols="50" rows="8" class="inputtext" id="textarea"></textarea> </td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">Bild<br> <span class="text">optional</span></td> <td colspan="2" bgcolor="#ECECFF" class="text"><input name="grafik" type="file" class="inputtext" size="40"> <br> nur JPEG - Bildformat</td> </tr> <tr> <td valign="top" bgcolor="#CCCCFF" class="titeldunkel">URL<br> <span class="text">optional</span></td> <td colspan="2" bgcolor="#ECECFF" class="text"> <input name="url" type="text" class="inputtext" id="url" size="50"> <br> hier können Sie einen Link (>>> mehr info) einfügen<br> Wenn Sie nicht intern, sonder auf eine fremde Seite verlinken, fügen Sie bitte die korrekteURL beginnend mit <span class="titeldunkel">http://</span>www.......... ein.</td> </tr> <tr> <td align="right" valign="top" bgcolor="#CCCCFF" class="titeldunkel"><input name="archivieren" type="checkbox" id="archivieren" value="1"></td> <td colspan="2" bgcolor="#ECECFF" class="text">Meldung soll beim Löschen ins Newsarchiv verschoben werden</td> </tr> <tr bgcolor="#6666CC"> <td> </td> <td colspan="2"> <input name="Submit" type="submit" class="inputtext" value="Meldung eintragen"> <input name="Submit2" type="reset" class="inputtext" value="Zurücksetzen"> <input name="input" type="hidden" id="input" value="1"> <input name="password" type="hidden" id="input2" value="<?PHP echo $password; ?>"> </td> </tr> </table> </form> </td> </tr> </table> <p> <?PHP } if($input==1 and $password==$passwort){ ?> <table width="100%" border="0" align="center" cellpadding="4" cellspacing="0"> <tr bgcolor="#666699"> <td height="20" colspan="2" class="titel"> <a href="artmedic_aktuell_admin.php?password=<?PHP echo $password; ?>" class="inputtext"> Neue Meldung </a> <a href="artmedic_aktuell_delete.php?password=<?PHP echo $password; ?>" class="inputtext"> Meldungen löschen </a> <a href="artmedic_aktuell_deletearchiv.php?password=<?PHP echo $password; ?>" class="inputtext"> Archiv-Meldungen löschen </a> </td> </tr> </table><br> <table width="500" border="0" cellspacing="0" cellpadding="2"> <tr> <td bgcolor="#666699" class="titel">Meldung wurde eingetragen</td> </tr> <tr> <td bgcolor="#FFFFFF"> <?PHP if($grafik_name!=""){ if($grafik_type != "image/jpeg") {die (" Fehler: \"$grafik_name\" ist keine gültige JPEG-Datei<br><br><a href=\"javascript:history.go(-1);\">«« Zurück </A>");}} //Startzeitpunkt festlegen $jahrstart = $_POST['jahrstart']; $monatstart = $_POST['monatstart']; $tagstart = $_POST['tagstart']; $stundestart = $_POST['stundestart']; $minutestart = $_POST['minutestart']; if(empty($stundestart)) {$stundestart = "0";} if(empty($minutestart)) {$minutestart = "0";}
if(!empty($jahrstart)) { $check = checkdate("$monatstart","$tagstart","$jahrstart"); if($check != 1)die("Der $tagstart.$monatstart.$jahrstart ist kein korrektes Datum.<br><br><a href=\"javascript:history.go(-1);\">«« Zurück </A>"); $timestampstart = mktime($stundestart,$minutestart,0,$monatstart,$tagstart,$jahrstart); } else {$timestampstart = time();} //stunde,minute,sekunde,M-d-Y $datum1 = strftime("%a, %d.%m.%Y %H:%M", "$timestampstart"); $datum1 = ereg_replace("Thu", "Donnerstag", $datum1); $datum1 = ereg_replace("Fri", "Freitag", $datum1); $datum1 = ereg_replace("Sat", "Samstag", $datum1); $datum1 = ereg_replace("Sun", "Sonntag", $datum1); $datum1 = ereg_replace("Mon", "Montag", $datum1); $datum1 = ereg_replace("Tue", "Dienstag", $datum1); $datum1 = ereg_replace("Wed", "Mittwoch", $datum1); echo "Startdatum: $datum1<br>"; //Klammerende ifjahrstart
//Ablaufzeitpunkt festlegen $jahrende = $_POST['jahrende']; $monatende = $_POST['monatende']; $tagende = $_POST['tagende']; $stundeende = $_POST['stundeende']; $minuteende = $_POST['minuteende']; if(!empty($jahrende)) { $check = checkdate("$monatende","$tagende","$jahrende"); if($check != 1)die("Der $tagende.$monatende.$jahrende ist kein korrektes Datum.<br><br><a href=\"javascript:history.go(-1);\">«« Zurück </A>"); if(empty($stundeende)) {$stundeende = "0";} if(empty($minuteende)) {$minuteende = "0";} $timestampende = mktime("$stundeende","$minuteende",0,"$monatende","$tagende","$jahrende"); //stunde,minute,sekunde,M-d-Y $datum2 = strftime("%a, %d.%m.%Y %H:%M", "$timestampende"); $datum2 = ereg_replace("Thu", "Donnerstag", $datum2); $datum2 = ereg_replace("Fri", "Freitag", $datum2); $datum2 = ereg_replace("Sat", "Samstag", $datum2); $datum2 = ereg_replace("Sun", "Sonntag", $datum2); $datum2 = ereg_replace("Mon", "Montag", $datum2); $datum2 = ereg_replace("Tue", "Dienstag", $datum2); $datum2 = ereg_replace("Wed", "Mittwoch", $datum2); echo "Endzeitpunkt: $datum2<br>"; } else { $timestampende = ""; $datum2 = ""; echo "zeitlich unbegrenzte Anzeige, Meldung muss bei Bedarf manuell gelöscht werden."; } //Daten aufbereiten $infotext = $_POST['infotext']; $titel = $_POST['titel']; $url = $_POST['url']; $infotext = ereg_replace("\n", "<br>", $infotext); $infotext = ereg_replace("\r", "", $infotext); $infotext = nl2br($infotext); $infotext = stripslashes($infotext); $infotext = preg_replace("/((http(s?):\/\/)|(www\.))([\w\_\-\/\.\?\=\&]+)/i", "<a href=\"http$3://$4$5\" target=\"_blank\">$2$4$5</a>", $infotext); $infotext = preg_replace("/([\w\_\-\.]+)(@)([\w\_\-\.]+)/i", "<a href=\"mailto:$0\">$0</a>", $infotext);
$titel = stripslashes($titel); //URL festlegen if($url!="") {$url = "<a href=\"$url\"> >>> mehr info</a>";} else {$url = "";} //Bild festlegen $id = time(); $bilderpfad ="$grafik_name"; @copy($grafik, $bilderpfad);
if(!is_file($bilderpfad)) {@move_uploaded_file($grafik, $bilderpfad);} if(is_file($bilderpfad)) { if($dest_width!="") { //Thumbnail erzeugen $scr= "$bilderpfad"; $dest = "$id".".jpg"; $imageInfo = getimagesize($scr); $src_width = $imageInfo[0]; $src_height = $imageInfo[1]; $dest_height = "$dest_width"*"$src_height"/"$src_width";
$src_img = imagecreatefromjpeg($scr); $dst_img = imagecreatetruecolor($dest_width,$dest_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, $dest, 70); imagedestroy($src_img); imagedestroy($dst_img); @unlink($bilderpfad); $bilderpfad = $dest; } @chmod($bilderpfad,0644); echo "<br>Bild $grafik_name ($grafik_size Bytes) wurde hochgeladen<br>"; $bildurl = "$scripturl"."$bilderpfad"; $bildhtml = "<td><img src=\"$bildurl\"></td>"; } else { echo "<br>Info: Es wurde kein Bild hochgeladen.<br>"; $bildhtml = "";} $archivieren = $_POST[archivieren]; //Daten speichern $fp = fopen("$news", "a+"); if($fp){ flock($fp,2); fputs ($fp, "$timestampstart&&$timestampende&&$datum1&&$titel&&$infotext&&$url&&$bilderpfad&&$bildhtml&&$archivieren&&\n"); flock($fp,3); fclose ($fp);} //Rückmeldung ausgeben $newstemplate= fopen ("$template","r"); $newshtml = fread($newstemplate, filesize($template)); $newshtml = ereg_replace("%titel%","$titel",$newshtml); $newshtml = ereg_replace("%datum%","$datum1",$newshtml); $newshtml = ereg_replace("%infotext%","$infotext",$newshtml); $newshtml = ereg_replace("%url%","$url",$newshtml); $newshtml = ereg_replace("%bild%", "$bildhtml", $newshtml); fclose ($newstemplate); echo "$newshtml"; ?> </td> </tr> </table> <?PHP //Klammerende ifinput } ?> </td> </tr> </table> <p> </p> </body> </html>
Vielen Dank schon mal im Vorraus!
Geändert von f1r9i9t4z (11.02.2013 um 17:02 Uhr)
Grund: Korrektur
|