<br>
<?php
include("../db_connection_xcart.php");
if($_POST['submit'])
{
$sql = "SELECT image_id FROM `xcart_products_images` ORDER BY `image_id` DESC";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if($num)
{
$image_id = $row['image_id'];
}
else
{
$image_id = "1_x";
}
$productid = $_POST['productid'];
$image_name = $image_id."_".$_FILES['location']['name'];
$location = "../images/T/".$image_name;
if(move_uploaded_file($_FILES['location']['tmp_name'], $location))
{
$insert = "insert into xcart_products_images values('null','".$_POST['productid']."','".$image_name."')";
mysql_query($insert);
echo "<div align='center'><font color='#00FF00'>File is successfully uploaded.</font></div>\n";
}
else
{
echo "Possible file upload attack!\n";
}
if($result = mysql_query($query_insert))
{
echo"<div align='center'><font color='#00FF00'>Added Succesfully</font></div>";
}
}
?>
<br>
<div align="center">
<table bgcolor="#FFFFFF" border="0"><form name="images" action="<?php $_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data">
<tr>
<td height="66" colspan="2" class="sectionheading" align="center"><b>ADD Multiple images</b></td>
</tr>
<tr>
<td height="26" align="left">
<b>product id : </b>
<?php
$query = "SELECT productid , product FROM xcart_products";
$product= mysql_query($query);
echo "<select name='productid' >";
while ($row = mysql_fetch_array($product))
{
echo "<option value='".$row[0]."'>".$row['product']."</option>";
}
echo"</select>";
?>
</tr>
<tr>
<td height="26" align="left" colspan="2">
<b>Image Location : </b>
<br>
<input type="file" name="location" size="40"></td>
</tr>
<tr>
<td> </td>
</tr>
<td align="center"><input type="button" name="close" value="Close" onClick="javascript:void(window.close())">
<input type="submit" name="submit" value="Upload Image" />
</td>
</tr></form>
</table>
</div>
</body>
No comments:
Post a Comment