The following code works fine. I want to know how to make this code enter more than one image at a time. I have a database that has image1, image2, etc... Any ideas would be appreciated.
<html>
<body>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="text" name="woodshelf_name" size="20">woodshelf name:<br>
<input type="file" name="imagefile" size="20">Image:<br>
<input type="text" name="woodshelf_1ftprice" size="20">woodshelf 1ft price:<br>
<input type="text" name="woodshelf_2ftprice" size="20">woodshelf 2ft price:<br>
<textarea rows="2" name="woodshelf_demensions" cols="20"></textarea>woodshelf demensions:<br>
<input type="text" name="woodshelf_inventory" size="20">Inventory In/Out Stock:<br>
<input type="text" name="woodshelf_cat" size="20">woodshelf Category 1ft/2ft:<br>
<input type="submit" name="Submit" value="Submit">
<input type="submit" name="Reset" value="Reset">
<?
$connection=mysql_connect("localhost","**","") or die("Could not connect to the database server");
$db= mysql_select_db("***",$connection) or die ("Unable to select database.");
**************Do I add another if statement
if (@is_uploaded_file($FILES["imagefile"]["tmp_name"])) {
copy($FILES["imagefile"]["tmp_name"], "../woodshelves/" . $FILES["imagefile"]["name"]);
echo "<p>File uploaded successfully.</p>";
echo "<br>";
echo "Name: ".$FILES['imagefile']['name']."<br>";
echo "Size: ".$FILES['imagefile']['size']."<br>";
echo "Type: ".$FILES['imagefile']['type']."<br>";
echo "Copy Done....";
$tempfilename = $_FILES['imagefile']['name'];
$CAT = "INSERT INTO woodshelf_category (woodshelf_cat) VALUES ('$woodshelf_cat')";
$CATResult = mysql_query($CAT) or die(mysql_error());
$woodshelf_catid= mysql_insert_id();
$SQL = "INSERT INTO woodshelves (woodshelf_name, woodshelf_1ftprice, woodshelf_2ftprice, woodshelf_demensions, woodshelf_inventory,woodshelf_image,woodshelf_catid) VALUES ('$woodshelf_name','$woodshelf_1ftprice','$woodshelf_2ftprice','$woodshelf_demensions','$woodshelf_inventory','$tempfilename', '$woodshelf_catid')";
$Result = mysql_query($SQL) or die(mysql_error());
echo "Test: ".$tempfilename."";
}
else {
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")
";
} )
?> </form>
</body>
</html>