Hi, OK I can see how that code by Shaydez works, and have set it so the client has up to 4 images they can upload.
It might be a bit too much but I have pasted the full page below, and beneath that I have posted the code by shaydez and my bit and where I will need some help.
<?php
include "config.php";
include "header2.php";
$flag=1;
$name="";
$meta="";
$ref="";
$desc="";
$maker="";
$date="";
$weight="";
$height="";
$depth="";
$width="";
$price="";
$sold="";
//$path="";
//$path2="";
$conf ="";
$update="";
$pcats="";
$subcats="";
$dt2=date("Y-m-d H:i:s");
if(isset($_GET['stock_Id']))
{
$stock_Id=$_GET['stock_Id'];
$q=mysql_query("select * from stock where stock_Id=$stock_Id") or die (mysql_error());
$rows=mysql_fetch_assoc($q);
$name=$rows["stock_Name"];
$meta=$rows["stock_MetaTitle"];
$pcats=$rows["parent_Category"];
$subcats=$rows["sub_Category"];
//$path=$rows["stock_Image"];
//$path2=$rows["stock_Image2"];
$ref=$rows["stock_Ref"];
$desc=$rows["stock_Description"];
$maker=$rows["stock_Maker"];
$date=$rows["stock_Date"];
$weight=$rows["stock_Weight"];
$height=$rows["stock_Height"];
$depth=$rows["stock_Depth"];
$width=$rows["stock_Width"];
$price=$rows["stock_Price"];
$sold=$rows["stock_Sold"];
$active=$rows["stock_Active"];
$time=$rows["stock_DateTime"];
$flag=0;
}
if(isset($_POST['btndelete']))
{
$sr=$_POST['srno1'];
$flag=$_POST['flag'];
if ($flag==0)
{
$q23=mysql_query("delete from stock where stock_Id=$sr") or die (mysql_error());
$flag=1;
}
else
{
}
}
if(isset($_POST['btnsubmit']))
{
$flag=$_POST['flag'];
if ($flag==0)
{
$name=$_POST['txtname'];
$desc1=$_POST['e1m1'];
//$src=$_FILES['logo']['tmp_name'];
//$fname=$_FILES['logo']['name'];
//$fname2=$_POST['logoCurrent'];
//$src2=$_POST['logoCurrent'];
$meta=$_POST['txtmeta'];
$sr=$_POST['srno1'];
$name=$_POST['txtname'];
$ref=$_POST['Ref'];
$desc=$_POST['e1m1'];
$maker=$_POST['Maker'];
$date=$_POST['Date'];
$weight=$_POST['Weight'];
$height=$_POST['Height'];
$depth=$_POST['Depth'];
$width=$_POST['Width'];
$price=$_POST['txtprice'];
$sold=$_POST['txtsold'];
//$path=$_POST['logoCurrent'];
$active=$_POST['active'];
$pcats=$_POST['pcats'];
$subcats=$_POST['subcats'];
//if($_FILES['logo']['name']=="") {
//copy("$src","$fname2");
//copy("$srcb","$fname2b");
$q24=mysql_query("update stock set stock_Name='$name', stock_MetaTitle='$meta', parent_Category='$pcats', sub_Category='$subcats', stock_Ref='$ref', stock_Description='$desc1', stock_Maker='$maker', stock_Date='$date', stock_Weight='$weight', stock_Height='$height', stock_Depth='$depth',stock_Width='$width', stock_Price='$price', stock_Sold='$sold', stock_Active='$active', stock_DateTime='$dt2' where stock_Id=$sr") or die (mysql_error());
$flag=1;
$conf="Data Updated Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_categories.php'>here</a> to continue";
$update="1";
//} else {
//copy("$src","imgdata/stock/$fname");
//$q24=mysql_query("update stock set stock_Name='$name', stock_MetaTitle='$meta', parent_Category='$pcats', sub_Category='$subcats', stock_Image='imgdata/stock/$fname', stock_Ref='$ref', stock_Description='$desc1', stock_Maker='$maker', stock_Date='$date', stock_Weight='$weight', stock_Height='$height', stock_Depth='$depth',stock_Width='$width', stock_Price='$price', stock_Sold='$sold', stock_Active='$active', stock_DateTime='$dt2' where stock_Id=$sr") or die (mysql_error());
//$flag=1;
//$conf="Data Updated Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_categories.php'>here</a> to continue";
//$update="1";
//}
}
else
{
$name=$_POST['txtname'];
$ref=$_POST['Ref'];
$desc=$_POST['e1m1'];
$maker=$_POST['Maker'];
$date=$_POST['Date'];
$weight=$_POST['Weight'];
$height=$_POST['Height'];
$depth=$_POST['Depth'];
$width=$_POST['Width'];
$price=$_POST['txtprice'];
$sold=$_POST['txtsold'];
//$src=$_FILES['logo']['tmp_name'];
//$fname=$_FILES['logo']['name'];
$meta=$_POST['txtmeta'];
//$path=$_FILES['logo']['name'];
$active=$_POST['active'];
$pcats=$_POST['pcats'];
$subcats=$_POST['subcats'];
//copy("$src","imgdata/stock/$fname");
$q=mysql_query("insert into stock (stock_Name, stock_MetaTitle, parent_Category, sub_Category, stock_Ref, stock_Description, stock_Maker, stock_Date, stock_Weight, stock_Height, stock_Depth, stock_Width, stock_Price, stock_Sold, stock_Active, stock_DateTime) values('$name','$meta','$pcats','$subcats','$ref','$desc','$maker','$date','$weight','$height','$depth','$width','$price','$sold','$active','$dt2')") or die (mysql_error());
$conf="Data Inserted Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_stock.php'>here</a> to continue";
$update=1;
}
}
?>
<script language="javascript" type="text/javascript">
function check()
{
flg=confirm("Data would be permanently deleted, Are you sure?");
if(flg==true)
{
return true;
alert("Record Deleted");
}
else
{
return false;
}
}
</script>
<!-- TinyMCE -->
<script type="text/javascript" src="./jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
editor_selector : "mceEditor",
editor_deselector : "mceNoEditor",
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "./css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "./lists/template_list.js",
external_link_list_url : "./lists/link_list.js",
external_image_list_url : "./lists/image_list.js",
media_external_list_url : "./lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<!-- /TinyMCE -->
<html>
<head>
<title>Sovereign Antiques Stock Management</title>
<link href="admin.css" rel="stylesheet" type="text/css" />
<SCRIPT LANGUAGE="JavaScript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=700,left = 420,top = 100');");
}
</script>
<!-- Added last night -->
<script type="text/javascript" src="jquery-1.4.min.js"></script>
<script type="text/javascript" language="javascript">
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
$(document).ready(function() {
$("#thumbnail img").click(function(e){
$("#background").css({"opacity" : "0.7"})
.fadeIn("slow");
$("#large").html("<img src='"+$(this).parent().attr("href")+"' alt='"+$(this).attr("alt")+"' /><br/>"+$(this).attr("rel")+"")
.center()
.fadeIn("slow");
return false;
});
$(document).keypress(function(e){
if(e.keyCode==27){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
}
});
$("#background").click(function(){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
});
$("#large").click(function(){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
});
});
</script>
</head>
<a name="Top"></a>
<body style="z-index:1;">
<div id="large"></div>
<div id="background"></div>
<form name="form1" action="admin_stock.php?index=<?=$index?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="flag" value="<?= $flag?>">
<table align="center">
<tr>
<div style="position:relative; height:90px; width:896px; background-color:#293334; margin-bottom:0px; margin-left:auto; margin-right:auto;">
<div style="position:relative; height:55px; width:100%; font-size:20px; color:#FFFFFF; font-family:Verdana, Arial, Helvetica, sans-serif; margin-left:25px; top:9px; font-weight:bold;">Sovereign Antiques 'Stock' Management Section</div>
<div style="position:relative; height:15px; width:100%;">
<div style="position:relative; float:left; margin-left:25px;">
<a href="main.php" class="topNav" title="Home">Home</a> <span style="color:#FFFFFF">|</span> <a href="index-logOut.php" class="topNav" title="Log Out">Log Out</a> <span style="color:#FFFFFF">|</span> <a href="http://www.accendsandbox.co.uk" target="_blank" class="topNav" title="Log Out">View Website</a> <span style="color:#FFFFFF">|</span>
</div>
</div>
</div>
</tr>
<!--<tr class="f1">
<td class="f1"><?= $conf ?></td>
</tr>-->
</table>
<table align="center" width="900" border="0" cellpadding="5" cellspacing="2">
<tr>
<td colspan="2" bgcolor="#222222" height="45" style="background-image:url(images/admin_Grey_Bar_Pages.jpg)">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:13px; color:#ffffff; font-weight:bold; position:relative; float:left; left:20px; top:-2px;">Create/Edit - 'Stock'</div>
</td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Title:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="txtname" size="84" value="<? echo $name;?>" /></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Meta-Title:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="txtmeta" size="84" value="<? echo $meta;?>" /></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Associated With:</div>
</td>
<td bgcolor="#888888" width="713">
<select name="pcats" size="1">
<option value="">Select Category</option>
<?php $qw=mysql_query("select cat_Id, category_Name from category order by category_Name ASC") or die (mysql_error());
while($r=mysql_fetch_assoc($qw))
{
if($r['cat_Id']==$pcats)
{
echo "<option value='$r[cat_Id]' selected>$r[category_Name]</option>";
}
else
{
echo "<option value='$r[cat_Id]'>$r[category_Name]</option>";
}
}
?>
</select>
or
<select name="subcats" size="1">
<option value="">Select Sub-Category</option>
<?php $qw=mysql_query("select sub_Id, sub_Name from sub_category order by sub_Name ASC") or die (mysql_error());
while($r=mysql_fetch_assoc($qw))
{
if($r['sub_Id']==$subcats)
{
echo "<option value='$r[sub_Id]' selected>$r[sub_Name]</option>";
}
else
{
echo "<option value='$r[sub_Id]'>$r[sub_Name]</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Reference Number:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Ref" size="25" value="<? echo $ref;?>" /></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Description:</div>
</td>
<td bgcolor="#888888" width="713"><textarea id="e1m1" name="e1m1" rows="25" cols="80" style="width:100%" class="mceEditor"><? echo $desc;?></textarea></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Maker:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Maker" size="84" value="<? echo $maker;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Date:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Maker" size="24" value="<? echo $date;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Weight:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Weight" size="24" value="<? echo $weight;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Height:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Height" size="24" value="<? echo $height;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Depth:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Depth" size="24" value="<? echo $depth;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Width:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="Width" size="24" value="<? echo $width;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">* Optional</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Price:</div>
</td>
<td bgcolor="#888888" width="713"><input type="text" name="txtprice" size="24" value="<? echo $price;?>" /> <span style="color:#990000 ; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11;">(eg 1500 - No need for '£')</span></td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Sold or For Sale:</div>
</td>
<td bgcolor="#888888" width="713">
<select name="txtsold" size="1">
<?php
if($sold==1)
{
echo "<option value='1' selected>Sold</option>";
echo "<option value='0'>For Sale</option>";
}
else
{
echo "<option value='1' >Sold</option>";
echo "<option value='0' selected>For Sale</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Images:</div>
</td>
<td bgcolor="#888888">
<?
set_time_limit(300);
$numoffile = 4; // Set how many file uploads you want.
if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$temp_file_location = $_FILES['myfiles']['tmp_name'][$i];
$old_upload_file = $_FILES['myfiles']['name'][$i];
// $newfile = $file_dir.$_FILES['myfiles']['name'][$i];
$newfile = $file_dir. $product_name . ".jpg";
$filemoved = move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], "upload/$old_upload_file");
// run any command here after every file upload.
$q24=mysql_query("update stock set stock_Image='x', stock_Image2='x', stock_Image3='x', stock_Image4='x' where stock_Id=$sr") or die (mysql_error());
$j++;
}
}
}
if (isset($j)&&$j>0) print "Your file(s) has been uploaded.<br>";
//print $newfile;
//print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='70'><br>";
}
//print "<input type='submit' name='action' value='Upload'>";
//print "</form>";
?>
</td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Active:</div>
</td>
<td bgcolor="#888888" width="713">
<select name="active" size="1">
<?php
if($active==1)
{
echo "<option value='1' selected>Active</option>";
echo "<option value='0'>Inactive</option>";
}
else
{
echo "<option value='1' >Active</option>";
echo "<option value='0' selected>Inactive</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td bgcolor="#A0B050" width="161"><br></td>
<td bgcolor="#888888" width="713">
<table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%">
<input type="submit" name="btnsubmit" value="Submit">
<input type="submit" name="btndelete" value="Delete" onClick="return check();">
<input type="hidden" name="srno1" value="<?= $rows["stock_Id"];?>">
<input type="hidden" name="action" value="Upload">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td valign="top" height="45" bgcolor="#eeeeee" width="161" style="background-image:url(images/admin_Grey_Bar_Smallest.jpg)">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:13px; color:#ffffff; font-weight:bold; position:relative; float:left; left:20px; top:7px;">Existing Stock</div>
</td>
<td bgcolor="#eeeeee" style="background-image:url(images/admin_Grey_Bar_509_No_Arrow.jpg)"><div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:13px; color:#777777; font-weight:normal; position:relative; float:left; left:20px; top:-2px; font-style:italic;">Select 'Existing Stock Name' below to edit or delete...</div></td>
</tr>
<tr>
<td width="161" bgcolor="#A0B050" height="35">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:10px;">Stock Name</div></td>
<td width="713" bgcolor="#A0B050" height="35">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:10px;">Stock Description</div><div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:right; width:100px; right:10px">Last Updated</div></td>
</tr>
<?php
$q=mysql_query("select * from stock order by stock_Name ASC") or die (mysql_error());
while($row=mysql_fetch_assoc($q))
{
echo "<tr>";
echo "<td bgcolor='#888888' width='161' valign='top'>";
echo "<p style='position:relative; left:9px;'><font size='2' color='#ffffff' face='Verdana,Arial,Helvetica,sans-serif'><a href='admin_stock.php?stock_Id=".$row["stock_Id"]."&index=".$index."' style='color:FFFFFF; font-weight:normal;'>".$row["stock_Name"]."</a></font></p>";
echo "</td>";
echo "<td bgcolor='#888888' width='713' valign='top'><div style='position:relative; float:left; width:550px;'><font size='2' color='#ffffff' face='Verdana,Arial,Helvetica,sans-serif' style='position:relative; left:9px;'>".substr($row['stock_Description'],0,61)."...</font></div><div style='position:relative; float:right; width:150px; right:-5px; border-left:#333333 dotted 1px; height:20px;'><font size='1' color='#ffffff' face='Verdana,Arial,Helvetica,sans-serif' style='position:relative; margin-left:10px;height:20px;top:3px;'>".$row["stock_DateTime"]."</font></div></td>";
echo "</tr>";
}
?>
<tr>
<td>
<div style="position:relative; width:100%; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px">Return to <a href="#Top">TOP</a></div>
</td>
<tr>
</table>
</form>
</div>
<?
if($update==1)
{
?>
<div id="cover">
<div id="warning">
<p align="center" style="color:#000000; font-weight:bold; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:20px;">
Your database was successfully updated - click the button below to return to admin.<br/><br/>
<input type="button" onClick="javascript:location.href=('http://www.accendsandbox.co.uk/adminSallam/admin_stock.php');" value="Return to admin" />
<br/><br/>
or
<br/><br/>
Click <a href="main.php">here</a> to return to main menu.
</p>
</div>
</div>
<? } else { ?>
<? } ?>
</body>
</html>
What I am trying to do below is upload each image to its specific field in the table ‘stock’
But I think it will only upload one image at a time, and this is the bit I need a bit of help with.
<td bgcolor="#A0B050" width="161">
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Images:</div>
</td>
<td bgcolor="#888888">
<?
set_time_limit(300);
$numoffile = 4; // Set how many file uploads you want.
if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$temp_file_location = $_FILES['myfiles']['tmp_name'][$i];
$old_upload_file = $_FILES['myfiles']['name'][$i];
// $newfile = $file_dir.$_FILES['myfiles']['name'][$i];
$newfile = $file_dir. $product_name . ".jpg";
$filemoved = move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], "upload/$old_upload_file");
// run any command here after every file upload.
$q24=mysql_query("update stock set stock_Image='x', stock_Image2='x', stock_Image3='x', stock_Image4='x' where stock_Id=$sr") or die (mysql_error());
$j++;
}
}
}
if (isset($j)&&$j>0) print "Your file(s) has been uploaded.<br>";
//print $newfile;
//print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='70'><br>";
}
//print "<input type='submit' name='action' value='Upload'>";
//print "</form>";
?>
</td>
</tr>
My bit is after:
// run any command here after every file upload.