Bildupload mit text
Stefan
- php
Hallo ich hab ein kleines Problem.
hab hier gerade das script geschrieben,
kann aber bei diesem folgenden script kein bild mit text gleichzeitig uploaden. wenn mir jemand helfen kann wär des super!!
also bitte sagt mir wo der fehler ligt!! danke!!!!
PS: in der galerie.html wird der text gespeichert.(als auf chmode 755 setzen)
hier das script:
<?
//Inistialisierung
$dateiname = "galerie.html";
//Lesen
if(file_exists($dateiname))
{
$datei = fopen ($dateiname, "r");
if($datei)
{
while($zeile = fgets($datei, 255))
{
echo stripslashes($zeile) . "<br>\n";
}
fclose($datei);
}
}
//Schreiben only TEXT
if(isset($text) && $text <>
"")
{
$zeile = "<div align="center"><center><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="557"><tr><td width="255"><p align="center">$text</td><td width="302"><p align="center">
<img border="0" src="$bildername" width="300" height="180"></td></tr></table></center></div><p>\n";
$datei = fopen ($dateiname, "a");
if($datei)
{
fputs($datei, $zeile);
fclose($datei);
}
}
?>
<?
//user defined variables
$abpath = "/SYSTEMPFAF VOM SERVER"; //systempfad
$sizelim = "no"; //so lassen
$size = "2500000"; //groesse vom bild
//erlaubte bildformate
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
//checks if file exists
if ($img1_name == "") {
$log .= "Es wurde kein Bild zum upload gefunden.<br>";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "Ein Bild mit diesem Dateinamen gibt es schon.<br>";
} else {
//checks if files to big
if (($sizelim == "yes") && ($img1_size > $size)) {
$log .= "Das Bild überschreitet die zugelassene größe.<br>";
} else {
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
@copy($img1, "$abpath/$img1_name") or $log .= "Bild konnte nicht upgeloadet werden.<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "Bild erfolgreich upgeloadet.<br>";
}
} else {
$log .= "Diese Datei ist kein Bild!<br>";
}
}
}
}
?>
<form method = "post">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3" height="161">
<tr>
<td width="27%" height="161">
<p align="center"><b><font face="Tahoma" size="2">Ihre Beschreibung zum Bild:</font></b></td>
<td width="73%" height="161">
<p align="left">
<textarea name="text" rows="10" cols="50"></textarea><br>
</td>
</tr>
</table>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="99%" id="AutoNumber2" height="40">
<tr>
<td width="27%" height="1">
<p align="center"><font face="Verdana" size="2"><b>Hier
Bildernamen eingeben:</b><br>
</font><font face="Verdana" size="1">(Den Namen des Bildes, <br>
z.B.: meinfisch.gif)<br>
<br>
</font></td>
<td width="73%" height="28">
<input type="text" name="bildername" size="30" value="*.gif">
<font face="Verdana" size="1">PS: das <b>.gif</b> zum Schluss muss stehen
bleiben!!!</font><br>
<br>
</td>
</tr>
<tr>
<td width="27%" height="42">
<p align="center"><b><font face="Verdana" size="2">Bitte Bild auswählen:</font></b></td>
<td width="73%" height="12">
<input type=file name=img1 size=30> <font size="1" face="Verdana">Hier das Bild
auswählen das oben genannt worden ist</font></td>
</tr>
</table>
</center>
</div>
<p align="center"><br>
<input type="submit" name="submit" value="Den neuen Eintrag auf der Webseite SPEICHERN">
</form>
<br>
<?
echo "$log";
?>
»»<form method = "post">
<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" method="post">
siehe <>http://selfaktuell.teamone.de/artikel/phpasp/php-uploadcheck/index.htm
lg
Ludwig
»»<form method = "post">
<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" method="post">
siehe <>http://selfaktuell.teamone.de/artikel/phpasp/php-uploadcheck/index.htm
lg
Ludwig
geht leider noch nicht :(