私はその同等のテキストボックス値の動的テキストボックスと動的イメージを作成しようとしています。私は私がarray.Iからの動的イメージがアップロードするコードを書くことをアップロードする必要が私のthought.whileを得たが、唯一の最後の画像は私uploaded.Helpなりますfriends..Hereは私のコードサーバのフォルダにイメージの配列をアップロードし、PHPのデータベースに保存
PHPコードです:
$query = "INSERT INTO tbl_content(user_id,heading,content,content_image) VALUES ";
for($i=0;$i<$itemCount;$i++) {
echo $cimage=$_FILES['image1']['name'][$i];
$q2=mysql_query("select max(user_id) as id from tbl_content");
$fe=mysql_fetch_array($q2);
$b=$fe['id']+1;
if($cimage!="")
{
$pos=strrpos($cimage,'.');
$mainext=substr($cimage,($pos+1));
$title=$b.'.'.$mainext;
move_uploaded_file($_FILES['image1']['tmp_name'][$i],$upload.$title);
} else {
$title="";
}
if(!empty($_POST["name1"][$i]) || !empty($_POST["name2"][$i])) {
$itemValues++;
if($queryValue!="") {
$queryValue .= ",";
}
$queryValue .= "('".$user_id. "', '".$_POST["name1"][$i]."', '".$_POST["name2"][$i]."', '".$cimage."')";
}
}
$sql = $query.$queryValue;
$itemValues;
if($itemValues!=0) {
$result = mysql_query($sql);
if(!empty($result)) $message = "Added Successfully.";
}
HTMLコード:
<DIV class="product-item float-clear" style="clear:both;">
<table cellspacing="2">
<tr>
<td><DIV class="float-left"><input type="checkbox" name="item_index[]" /></DIV></td>
<td><DIV class="float-left">Heading:<input type="text" name="name1[]" style="width:60px" /></DIV></td>
<td><DIV class="float-left">Content:<textarea type="text" name="name2[]" style="width:90px"/></textarea></DIV></td>
<td>
<DIV><input name="image1[]" id="pro_image" type="file" size="45" /></Div></td>
</DIV>
</tr>
</table>
</body>
友人に私を助けて.....
可能性のある重複した[のを持つ複数のファイルを選択する方法?](http://stackoverflow.com/questions/1593225/how-to-select-multiple-files-with-input-type-file) – CarlosCarucce