Billede uploader ikke
Koden her uploader alt andet end lige billedet og jeg kan ikke se hvorfor:<?php
include_once('connect.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
class Billede {
public $varernr;
function BilledeUpload() {
$mappe="produktbilleder/";
$billednavn = time() . $_FILES[billedfil][name];
copy($_FILES[billedfil] [tmp_name], $mappe.$billednavn);
$billede = $mappe."".$billednavn;
}
}
{
if (isset($_POST['Submit']) ) {
$test_1 = new Billede();
$test_2 = new sql();
$test_1->varernr = time();
$test_2->connect();
$test_2->q("INSERT INTO hardware_produkter (title, producent, katid, antal, txt, billedesti, varernr, pris)
VALUES ('".$_POST['title']."','".$_POST['producent']."','".$_POST['katid']."','".$_POST['antal']."','".$_POST['txt']."','".$billede."','".$varernr."','".$_POST['pris']."')");
$test_1->BilledeUpload();
$test_2->close();
?>
<?php
}
?>
<form action="" method="post" enctype="multipart/form-data" name="upload_form">
<input type="hidden" name="varernr" value="$varernr">
<table width="600" border="0">
<tr>
<td width="90" valign="top">Overskrift:</td>
<td width="500"><input type="text" name="title" size="37"></td>
</tr>
<tr>
<td width="90" valign="top">Producent:</td>
<tr>
<td width="90" valign="top">Antal: </td>
<td width="500">
<input type="text" name="antal" maxlength="" value="" />
</td></tr>
<tr>
<td width="90" valign="top">Pris: </td>
<td width="500">
<input type="text" name="pris" maxlength="" value="" />
</td></tr>
<tr>
<td width="90" valign="top">Vælg billede: </td>
<td width="500">
<input type="file" name="billedfil" />
<input type="submit" name="Submit" value="Upload" />
</td></tr>
</table>
<p>Tekst: <br />
<br />
<textarea name="txt" style="width:450px; height:175px;"></textarea>
</form>
<?php
echo "Produktet er nu uploadet!";
}
?>
</html>
