可能重複:
Warning: mysql_fetch_* expects parameter 1 to be resource, boolean given error警告:move_uploaded_file
我回來了再還學習了多個上傳。好吧,我在這裏有一個情況。和我得到2警告:
警告:move_uploaded_file()以期望參數1是串,陣列中的F中給出:\瓦帕\ WWW \ DKI \ 1個\ entry_fotos.php在線路32
警告: move_uploaded_file()以期望參數1是串,陣列中的F中給出:\瓦帕\ WWW \ DKI \ 1個\ entry_fotos.php第45行上
和這是代碼
$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>
,我希望這是更容易被發現。非常感謝您的幫助
呼應的var_dump($ ne_photo_images); var_dump($ fe_photo_images);結果在執行之前:array(size = 0) empty array(size = 0) empty – 2012-08-02 08:33:34
echoing var_dump($ ne_photo_images);後續代碼var_dump($ fe_photo_images);結果是:array(size = 1) 0 => string'Lighthouse.jpg'(length = 14) – 2012-08-02 08:36:07
現在我可以完成它,也許這可以爲新手 – 2012-08-02 18:03:25