Adding more thumbnails to upload with this script

I have a script that uploads data and a thumbnail. No problem. The issue is that I’d now like to add three or four images, not just one. I have tried a few combinations with no success. Here is the upload form and the upload script. Any help is appreciated.

[php]<?php
$catid=$_POST[‘catid’];
$Year=$_POST[‘Year’];
$Manufacturer=$_POST[‘Manufacturer’];
$Model=$_POST[‘Model’];
$description=$_POST[‘description’];
$price=$_POST[‘price’];

if (get_magic_quotes_gpc())
{
$catid = stripslashes($catid);
$Year = stripslashes($Year);
$Manufacturer = stripslashes($Manufacturer);
$Model = stripslashes($Model);
$description = stripslashes($description);
$price = stripslashes($price);

}
$catid = mysql_real_escape_string($catid);
$Year = mysql_real_escape_string($Year);
$Manufacturer = mysql_real_escape_string($Manufacturer);
$Model = mysql_real_escape_string($Model);
$description = mysql_real_escape_string($description);
$price = mysql_real_escape_string($price);

$thumbnail = getThumb($_FILES[‘picture’]);
$thumbnail = mysql_real_escape_string($thumbnail);

$query=“INSERT INTO products (catid, Year, Manufacturer, Model, description, price, picture) VALUES (’$catid’, ‘$Year’, ‘$Manufacturer’, ‘$Model’, ‘$description’, ‘$price’, ‘$thumbnail’)”;

$result = mysql_query($query) or die(‘Unable to add product’);
if ($result)
echo “

New product added

\n”;
else
echo “

Problem adding new product

\n”; [/php]

[php]<?php
if (!isset($_SESSION[‘store_admin’]))
{
echo “

Sorry, you have not logged into the system

\n”;
echo “<a href=“admin.php”>Please login\n”;
} else
{
$userid = $_SESSION[‘store_admin’];
echo “<form enctype=“multipart/form-data” action=“admin.php” method=“post”>\n”;
echo “

Enter the new product information


\n”;
echo “<table width=“100%” cellpadding=“1” border=“1”>\n”;
echo “ Category\n”;
echo “<select name=“catid”>\n”;

$query=“SELECT catid,name from categories”;
$result=mysql_query($query);
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
$catid = $row[‘catid’];
$name = $row[‘name’];
echo “<option value=”$catid">$name\n";
}
echo “

\n”;

echo “

Year <input type=“text” size=“4” name=“Year”> \n”;

echo “

Manufacturer <input type=“text” size=“50” name=“Manufacturer”> \n”;
echo “ Model <input type=“text” size=“50” name=“Model”> \n”;

echo “

Description <input type=“text” size=“40” name=“description”> \n”;
echo “ Price <input type=“text” size=“10” name=“price”> \n”;

echo “<input type=“hidden” name=“MAX_FILE_SIZE” value=“1024000”>\n”;
echo “

Picture <input type=“file” name=“picture”> \n”;

echo “\n”;
echo “<input type=“submit” value=“Submit”>\n”;
echo “<input type=“hidden” name=“content” value=“addproduct”>\n”;
echo “\n”;
}
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service