0
<form name="property" action="" method="post" enctype="multipart/form-data">
Select Image
<input type="file" name="upload[]" multiple="multiple" id="image"/>
<input type="submit" value="Submit" name="submit" style="width:200px; height:30px;" />
</form>
我的PHP代碼:有多個圖片上傳的問題? DB圖像連接
if(isset($_POST['submit']))
{
$total = count($_FILES['upload']['name']);
for($i=0; $i<$total; $i++)
{
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
if ($tmpFilePath != "")
{
$newFilePath[] = "upload/" . $_FILES['upload']['name'][$i];
$values_insert = implode(',', $newFilePath);
if(move_uploaded_file($tmpFilePath, $newFilePath))
{
$date=date("Y-m-d");
}
}
}
$d=mysql_query("INSERT INTO properties (iname,cdate) VALUES('".$values_insert."',NOW())") or die(mysql_error());
}
注:
在數據庫的路徑上傳目錄文件夾和圖像的圖像將會數據庫,我想只圖像名稱分隔逗號。例如預期的輸出是Chrysanthemum.jpg,Desert.jpg。我不知道是什麼問題。請引導me.kindly看看我的代碼和圖像附件的詳細信息。