Php file upload fejl
Dette php upload virker ikke. Det printer fejl over hele siden.Hvorfor?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!-- Minus AutoDato -->
<title>[Ingen titel]</title>
<meta name="Generator" content="Stone's WebWriter 4">
</head>
<body>
<?php
if(isset($_POST['upload']))
{ $text = $_POST['titel'];
mysql_connect("localhost", "m", "m") or die(mysql_error());
mysql_select_db("m") or die(mysql_error());
mysql_query("INSERT INTO pixelbilleder (titel) VALUES ('$text')") OR DIE(mysql_error());
$id = mysql_insert_id();
$extension = 'jpg';
for($i = i; $i <= 2; $i++){
if (move_uploaded_file($_FILES['minfil']['tmp_name'], $id . '-' . $i . '.' . $extension)){
echo 'Fil: ' . $i . ' - Uploaded';
}else{
echo 'Fil: ' . $i . ' - Fejl';
}
}
}
else
{
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
Vælg fil 1: <input name="minfil[1]" type="file"><br />
Vælg fil 2: <input name="minfil[2]" type="file"><br />
Titel: <input name="titel" type="file"><br />
<input type="submit" name="upload" value="Upload fil">
</form>
<?
}
?>
</body>
</html>