Merhaba, elimdeki bir scriptte çoklu resim upload yapmak istiyorum. Fakat ne kadar uğraştıysam beceremedim. Tek resim seçilebiliyor ve tek resim veritabanına kaydediliyor. Yardımcı olursanız sevinirim.<? include "include/all.php";?>
<?
$ParentID = $_REQUEST['ParentID'];
$Action = $_REQUEST['Action'];
$ID = $_REQUEST['ID'];
if (isset($_REQUEST['miSend']))
{
$sql = "insert into t_advert_images (ParentID, Seq, Visible) values('".$ParentID."', '".$_REQUEST['Seq']."', '".getVisible($_REQUEST['Visible'])."')";
insertSql($sql);
$LastID = simpleQuery("select ID from t_advert_images where ParentID='".$ParentID."' order by Seq desc");
$list = getImageInfo1();
foreach ($list['items'] as $rs)
{
if(uploadImage($_FILES['Image']['tmp_name'], "../".$rs['path']."/".$ParentID."_".$LastID."_".$rs['name'].".jpg", $rs['width'], $rs['height'], $rs['compress'], $rs['watermark_image'], "../".$rs['watermark_logo'], $rs['watermark_border_width'], $rs['watermark_position'], $rs['image_text'], $rs['text'], "../".$rs['font_type'], $rs['font_size'], $rs['alpha'], $rs['text_position'], $rs['text_border_width']) == true)
{
$sql = "update t_advert_images set Images='".$ParentID."_".$LastID."' where ID='".$LastID."'";
updateSql($sql);
}
else
{
break;
}
}
if(!$error)
{
$CloseWindow = "<script>\n";
$CloseWindow .= "\twindow.opener.location.reload();\n";
$CloseWindow .= "\twindow.close();\n";
$CloseWindow .= "</script>\n";
}
else
{
echo $error;
}
}
$sql = "select * from t_advert_images where ID='".$ID."'";
$qr = mysql_query($sql);
$rs = mysql_fetch_array($qr);
?>
<html>
<head>
<SCRIPT language=Javascript src="js/function.js"></SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> <?=($Title)?></title>
<style type="text/css">
<!--
body {
background-color: #e0e0e0;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/style.css" rel="stylesheet nofollow" type="text/css">
<?=(isset($CloseWindow)?$CloseWindow:"")?>
<?=(isset($Err)?$Err:"")?>
</head>
<body>
<br>
<form method="post" action="advert_add_images.php" enctype="multipart/form-data">
<input type="hidden" name="miSend" id="miSend" value="100">
<input type="hidden" name="Action" id="Action" value="<?=($Action)?>">
<input type="hidden" name="ParentID" id="ParentID" value="<?=($ParentID)?>">
<input type="hidden" name="ID" id="ID" value="<?=($ID)?>">
<?=(getContentTop(AddNewImage, "144"))?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" id="lang-menu"><table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5"><img src="images/spacer.gif" width="1" height="1"></td>
<td class="FontBlueBold"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="e0e0e0">
<tr>
<td height="30" class="record-inactive"> <?=(Image)?></td>
<td class="record-inactive"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100"><input name="Image" multiple type="file" id="Image"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" class="record-active"> <?=(Sequence)?></td>
<td class="record-active"><input name="Seq" type="text" id="Seq" class="price-input" onKeyDown="return CheckNumberCode(event);" value="<?=($rs['Seq']!=''?$rs['Seq']:GetName("select * from t_advert_images where ParentID='".$ParentID."'order by Seq desc", "Seq")+5)?>" size="5" maxlength="4"></td>
</tr>
<tr>
<td width="120" height="25" class="record-inactive"> <?=(Show)?></td>
<td class="record-inactive"><input name="Visible" type="checkbox" id="Visible" value="1" class="checkbox" <?=($rs['Visible']==1?"checked":"")?>></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<?=(getContentFooter())?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> </td>
<td width="100"><input type="button" class="button" onClick="window.close();" value="<?=(Cancel)?>"></td>
<td width="5"></td>
<td width="100"><input type="submit" class="button" value="<?=(Save)?>"></td>
<td width="7"></td>
</tr>
</table>
</form>
<br>
</body>
</html>
Zaman
2012-05-07 16:49:05Php Multiple Resim Upload Sorunu