2015-10-19 39 views
0

當我嘗試上傳多個圖像上傳到PHP時,出現'注意:未定義偏移:6 $ _FILES'且偏移號太多循環。 這裏代碼HTML

<input type="file" name="imagetest[]"><br> 
<input type="file" name="imagetest[]"><br 
<input type="file" name="imagetest[]"><br> 
<input type="submit" value="Upload"> 

和PHP代碼

for($i=0;count($_FILES['imagetest']['tmp_name']);$i++){ 
    echo (($_FILES['imagetest']['tmp_name'][$i])); 
} 

請幫助我,我更年輕的PHP語言

+0

停止使用php代替nodejs。 –

回答

0

在你for loop應編輯second expression

如果它的計算結果爲TRUE,則循環繼續,並執行嵌套的 語句。如果它評估爲FALSE,則循環結束時執行 。

for($i = 0;$i < count($_FILES['imagetest']['tmp_name']);$i++){ 
    echo $_FILES['imagetest']['tmp_name'][$i]; 
} 
+0

只需刪除((,))?它不工作。 :( –

+1

不行。在for循環中編輯第二個表達式。$ i kotapeter

+0

Oop,我明白了,這是我的錯誤,非常感謝q –