> Forums > PHP

B

Bildupload

phpinfo Mi., 18. Oktober, 2006 um 23:51 #1

[php:1]<?
if(isset($submit) && $submit=="uploaden!"){

if(substr_count($thefile_type, "image/") < 1) {
echo "Falsches Datei-Format<BR><B>Bild (Foto) muss in *.GIF oder *.JPG vorliegen!</B><HR>";

echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
DIE("</form>");
}

if($thefile_size > 2000000){
echo "Das Bild ist zu gross (Bild muss kleiner als 2 MB sein)!<HR>";

echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
DIE("</form>");
}

if($thefile!="none"){
// Uploaden beginnen //

if(!copy ($thefile,"../../bilder/$thefile_name")){
// Ups, es passierte ein Fehler beim Kopieren
echo "<B>EIN FEHLER IST AUFGETRETEN.<BR>Bitte versuchen Sie es erneut.";
echo "<HR>Ist der Dateiname bereits vorhanden? ($thefile_name)</B><HR><BR><BR>";
echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
DIE("</form>");
} else {


echo "Das File wurde erfolgreich auf den Server übertragen!<BR>(Dateiname: $thefile_name)<br>&nbsp;<p><input type="text" name="T1" size="75" value=""></p></form><HR><BR><BR>";
echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
DIE("</form>");
}

}else{
if($thefile!="none"){
echo "Dieses File ist keine g&uuml;ltige Grafikdatei (*.GIF oder *.JPG oder *.JPEG)!<HR>";

echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
echo "</form>";
}else{
echo "Kein File übertragen<HR>";

echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
echo "</form>";
}
}
}else{

echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"2000000\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo "Bild ausw&auml;hlen: <input name=\"thefile\" type=\"file\">";
echo "<BR><input type=\"submit\" name=\"submit\" value=\"uploaden!\">";
echo "</form>";

}
?>[/php:1]



C&M distanziert sich konkret und ausdrücklich vom Inhalt dieses Postings.
Der Ersteller des Postings haftet für seine Äußerungen.
Inhalte, die nicht den Forumsregeln entsprechen sind bitte vom Leser zu melden ...

> Forums > PHP

Du hast bereits für diesen Post angestimmt...

;-)



Logo https://t.ress.at/8hLck/




Top