Formular:
Code:
<form enctype="multipart/form-data" method="post" action="meldung.php">
<table>
<tr>
<td>Bottername:</td>
<td><input type="text" name="botter"></td>
</tr>
<tr>
<td>Opfername:</td>
<td><input type="text" name="opfer"></td>
</tr>
<tr>
<td>Bild 1:</td>
<td><input name="pica" type="file"></td>
</tr>
</table>
<input type="submit">
</form>
Verarbeitung:
PHP-Code:
$uploaddir = '/var/www/images/';
mysql_connect("localhost","*****","******");
mysql_select_db("bots");
$bot = $_POST[botter];
$opfer = $_POST[opfer];
$insert = mysql_query("INSERT INTO botter
(bot, opfer, time)
VALUES
('$bot', '$opfer', '".time()."') ")
or die(mysql_error());
print "<pre>";
if (move_uploaded_file($_FILES['pica']['tmp_name'], $uploaddir . $_FILES['pica']['name'])) {
print "File is valid, and was successfully uploaded. Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
echo "Botter wurden gespeichert.";
mysql_close();
?>
Fehlermeldung:
Code:
Possible file upload attack! Here's some debugging info:
Array
(
[pica] => Array
(
[name] => bannergb.gif
[type] => image/gif
[tmp_name] => /tmp/phptjSbLv
[error] => 0
[size] => 27497
)
)
Botter wurden gespeichert.
Er lädt die Datei nicht hoch, obwohl die Fehlermeldung = 0 ist (also es gabe keine Fehler) finde die Ursache des Problems nicht.[/code]