我又回来了,还在学习多重上传。好的,我在这里遇到了情况。我收到了 2 个警告:
警告:move_uploaded_file() 期望参数 1 为字符串,数组在第 32 行的 F:\wamp\www\dki\1\entry_fotos.php 中给出
警告:move_uploaded_file() 期望参数 1 为字符串,数组在第 45 行的 F:\wamp\www\dki\1\entry_fotos.php 中给出
这是代码
$ne_photo_images = $_FILES['ne_photo_image']['name'];
$fe_photo_images = $_FILES['fe_photo_image']['name'];
$tmp_file = $_FILES['ne_photo_image']['tmp_name'];
$tmp_file1 = $_FILES['fe_photo_image']['tmp_name'];
if(!is_array($ne_photo_images)) {
$ne_photo_images = array();
}
if(!is_array($tmp_file)) {
$tmp_file = array();
}
if(! move_uploaded_file($tmp_file, 'image/' . $ne_photo_images))
if(!is_array($fe_photo_images)) {
$fe_photo_images = array();
}
if(!is_array($tmp_file1)) {
$tmp_file1 = array();
}
if(! move_uploaded_file($tmp_file1, 'image/' . $fe_photo_images))
我之前从我的问题反馈中得到了这个查询代码
$sql = "INSERT INTO photo(`photo_id`, `ne_photo_image`, `fe_photo_image`, `hop_id`, `title`) VALUES";
for($i = 0, $l = sizeof($titles) ; $i < $l ; $i++)
{
//adding row datas
$sql .= " (null,
'".$ne_photo_images [$i]."',
'".$fe_photo_images [$i]."',
'".$hopid."',
'".$titles[$i]."')";
if($i < $l - 1)
$sql .= ",";
}
if(mysql_query($sql))
{
}
这是我的表格:
<form method="post" enctype="multipart/form-data">
<table border="0"cellpadding="0" cellspacing="0" width= "100%">
<tr>
<td>Hop Name :<?echo "$data[hop_name]"?>
<input type='hidden' name='photo_hop_id' value='<?echo"$data[hop_id]"?>'>
</td>
</tr>
<table border="0"cellpadding="0" cellspacing="0" width= "100%">
<tr>
<td cellpadding="0" cellspacing="0" width= "50%">
Near End Site Name : <?echo "$data[ne_site_name]"?>
</br>
Near End Site Id : <?echo "$data[ne_site_code]"?>
</td>
<td cellpadding="0" cellspacing="0" width= "50%">
Far End Site Name : <?echo "$data[fe_site_name]"?>
</br>
Far End Site Id : <?echo "$data[fe_site_code]"?>
</td>
</tr>
<tr>
<td cellpadding="0" cellspacing="0" width= "50%">
<? $pm1= mysql_query("SELECT photo_name FROM photo_name WHERE photo_name_id = 1");
$dpm1 = mysql_fetch_array ($pm1);echo"$dpm1[0]"?>
<input type='hidden' name='photo_name_id[]' value='<?echo"$dpm1[0]"?>'> :
<input type="file" name="ne_photo_image[]">
</td>
<td cellpadding="0" cellspacing="0" width= "50%">
<?echo "$dpm1[0]"?> : <input type="file" name="fe_photo_image[]">
</td>
</tr>
</table>
</table>
<input type="submit" value="tambah" />
</form>
我希望这更容易发现。非常感谢您的帮助