i have now updated it. It now adds to a database but does not display. Can anyone help please 
Code:
//addproduct.php
<table width="600" height="382" border="3" BORDERCOLOR="#CD3788" bgcolor="#FFFFFF" align="center" cellpadding="0" cellspacing="2">
<tr>
<form action="addproduct_action.php" method="post" enctype="multipart/form-data">
<td>
<table width="100%" border="0" BORDERCOLOR="#CD3788" cellpadding="3" cellspacing="1">
<tr>
<td colspan="3"><strong>Add Product</strong></td>
</tr>
<tr>
<td><font color="black">Add Image</font></td>
<td>:</td>
<td><input type="file" name="image" id="image" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="submit" value="Add">
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
Code:
//addproduct_action.php
<?php
include('config.php');
$file = $_FILES['image']['tmp_name'];
if (!isset ($file)){
echo "Please select an image";
}else{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
}
if($image_size==false){
echo "Thats not an image";
}else{
$insert = mysql_query("INSERT INTO products VALUES ('','$image_name','$image')") or die("Problem uploading image.");
echo mysql_error();
$lastid = mysql_insert_id();
echo "Image uploaded. <br />Your image:<p /><img src=get.php?id=$lastid>";
}
?>
Code:
//get.php
<?php
include('config.php') or die(mysql_error());
$id = addslashes($_REQUEST['id']);
$image = mysql_query("SELECT * FROM products WHERE id=$id");
$image = mysql_fetch_assoc ($image) ;
$image = $image ['image'];
header ("Content-type: image/jpeg");
echo $image;
?>
Bookmarks